summaryrefslogtreecommitdiff
path: root/ext/cog
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2013-02-11 12:25:05 -0800
committerDavid Schleef <ds@schleef.org>2013-02-11 12:30:29 -0800
commit3cddc007cb5b3aed7be7210bf1cb4fcf6afede06 (patch)
treed786bcf8108b20cdb21c4ce1b6bfc6b0401c3b5d /ext/cog
parentdee6536421a3f5d62264ddcca7954635f1c529fe (diff)
downloadgstreamer-plugins-bad-3cddc007cb5b3aed7be7210bf1cb4fcf6afede06.tar.gz
cog: remove cog plugin
Everything has been merged into other elements.
Diffstat (limited to 'ext/cog')
-rw-r--r--ext/cog/Makefile.am46
-rw-r--r--ext/cog/cog.h10
-rw-r--r--ext/cog/cogframe.c984
-rw-r--r--ext/cog/cogframe.h208
-rw-r--r--ext/cog/cogtables.c516
-rw-r--r--ext/cog/cogutils.h108
-rw-r--r--ext/cog/cogvirtframe.c2200
-rw-r--r--ext/cog/cogvirtframe.h55
-rw-r--r--ext/cog/generate_tables.c239
-rw-r--r--ext/cog/gstcms.c575
-rw-r--r--ext/cog/gstcms.h71
-rw-r--r--ext/cog/gstcog.c68
-rw-r--r--ext/cog/gstcogdownsample.c378
-rw-r--r--ext/cog/gstcogmse.c558
-rw-r--r--ext/cog/gstcogorc-dist.c15553
-rw-r--r--ext/cog/gstcogorc-dist.h150
-rw-r--r--ext/cog/gstcogscale.c653
-rw-r--r--ext/cog/gstcogutils.c185
-rw-r--r--ext/cog/gstcogutils.h37
19 files changed, 0 insertions, 22594 deletions
diff --git a/ext/cog/Makefile.am b/ext/cog/Makefile.am
deleted file mode 100644
index 8100fc2f9..000000000
--- a/ext/cog/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-plugin_LTLIBRARIES = libgstcog.la
-
-ORC_SOURCE=gstcogorc
-include $(top_srcdir)/common/orc.mak
-
-libgstcog_la_CFLAGS = \
- -DCOG_ENABLE_UNSTABLE_API \
- $(GST_PLUGINS_BAD_CFLAGS) \
- -I$(srcdir)/.. \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_CFLAGS) \
- $(ORC_CFLAGS) \
- $(COG_CFLAGS)
-libgstcog_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
- $(GST_BASE_LIBS) \
- $(GST_LIBS) \
- $(ORC_LIBS) \
- $(COG_LIBS)
-libgstcog_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBM)
-libgstcog_la_LIBTOOLFLAGS = --tag=disable-static
-
-libgstcog_la_SOURCES = \
- cog.h \
- cogframe.c \
- cogframe.h \
- cogtables.c \
- cogutils.h \
- cogvirtframe.c \
- cogvirtframe.h \
- gstcog.c \
- gstcogdownsample.c \
- gstcogmse.c \
- gstcogscale.c \
- gstcogutils.c \
- gstcogutils.h \
- gstcms.h \
- gstcms.c
-nodist_libgstcog_la_SOURCES = $(ORC_NODIST_SOURCES)
-
-noinst_PROGRAMS = generate_tables
-generate_tables_SOURCES = generate_tables.c gstcms.c
-generate_tables_CFLAGS = $(GST_CFLAGS)
-generate_tables_LDADD = $(GST_LIBS) $(LIBM)
-
-
diff --git a/ext/cog/cog.h b/ext/cog/cog.h
deleted file mode 100644
index bf58cd3a6..000000000
--- a/ext/cog/cog.h
+++ /dev/null
@@ -1,10 +0,0 @@
-
-#ifndef __COG_COG_H__
-#define __COG_COG_H__
-
-#include <cog/cogutils.h>
-
-void cog_init (void);
-
-#endif
-
diff --git a/ext/cog/cogframe.c b/ext/cog/cogframe.c
deleted file mode 100644
index 1993bba96..000000000
--- a/ext/cog/cogframe.c
+++ /dev/null
@@ -1,984 +0,0 @@
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <cog/cog.h>
-#include <cog/cogframe.h>
-#include <cog/cogvirtframe.h>
-#include "gstcogorc.h"
-#include <gst/gst.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-/**
- * cog_frame_new:
- *
- * Creates a new CogFrame object. The created frame is uninitialized
- * and has no data storage associated with it. The caller must fill
- * in the required information.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new (void)
-{
- CogFrame *frame;
-
- frame = g_malloc0 (sizeof (*frame));
- frame->refcount = 1;
-
- return frame;
-}
-
-/**
- * cog_frame_new_and_alloc:
- *
- * Creates a new CogFrame object with the requested size and format.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_and_alloc (CogMemoryDomain * domain, CogFrameFormat format,
- int width, int height)
-{
- return cog_frame_new_and_alloc_extended (domain, format, width, height, 0);
-}
-
-CogFrame *
-cog_frame_new_and_alloc_extended (CogMemoryDomain * domain,
- CogFrameFormat format, int width, int height, int extension)
-{
- CogFrame *frame = cog_frame_new ();
- int bytes_pp;
- int h_shift, v_shift;
- int chroma_width;
- int chroma_height;
-
- g_return_val_if_fail (width > 0, NULL);
- g_return_val_if_fail (height > 0, NULL);
-
- frame->format = format;
- frame->width = width;
- frame->height = height;
- frame->domain = domain;
- frame->extension = extension;
-
- if (COG_FRAME_IS_PACKED (format)) {
- g_return_val_if_fail (extension == 0, NULL);
-
- frame->components[0].format = format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- if (format == COG_FRAME_FORMAT_AYUV) {
- frame->components[0].stride = width * 4;
- } else {
- frame->components[0].stride = ROUND_UP_POW2 (width, 1) * 2;
- }
- frame->components[0].length = frame->components[0].stride * height;
-
- frame->regions[0] = g_malloc (frame->components[0].length);
-
- frame->components[0].data = frame->regions[0];
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- return frame;
- }
-
- switch (COG_FRAME_FORMAT_DEPTH (format)) {
- case COG_FRAME_FORMAT_DEPTH_U8:
- bytes_pp = 1;
- break;
- case COG_FRAME_FORMAT_DEPTH_S16:
- bytes_pp = 2;
- break;
- case COG_FRAME_FORMAT_DEPTH_S32:
- bytes_pp = 4;
- break;
- default:
- g_return_val_if_reached (NULL);
- bytes_pp = 0;
- break;
- }
-
- h_shift = COG_FRAME_FORMAT_H_SHIFT (format);
- v_shift = COG_FRAME_FORMAT_V_SHIFT (format);
- chroma_width = ROUND_UP_SHIFT (width, h_shift);
- chroma_height = ROUND_UP_SHIFT (height, v_shift);
-
- frame->components[0].format = format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_4 ((width + extension * 2) * bytes_pp);
- frame->components[0].length =
- frame->components[0].stride * (frame->components[0].height +
- extension * 2);
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- frame->components[1].format = format;
- frame->components[1].width = chroma_width;
- frame->components[1].height = chroma_height;
- frame->components[1].stride =
- ROUND_UP_4 ((chroma_width + extension * 2) * bytes_pp);
- frame->components[1].length =
- frame->components[1].stride * (frame->components[1].height +
- extension * 2);
- frame->components[1].v_shift = v_shift;
- frame->components[1].h_shift = h_shift;
-
- frame->components[2].format = format;
- frame->components[2].width = chroma_width;
- frame->components[2].height = chroma_height;
- frame->components[2].stride =
- ROUND_UP_4 ((chroma_width + extension * 2) * bytes_pp);
- frame->components[2].length =
- frame->components[2].stride * (frame->components[2].height +
- extension * 2);
- frame->components[2].v_shift = v_shift;
- frame->components[2].h_shift = h_shift;
-
- frame->regions[0] = g_malloc (frame->components[0].length +
- frame->components[1].length + frame->components[2].length);
-
- frame->components[0].data = COG_OFFSET (frame->regions[0],
- frame->components[0].stride * extension + bytes_pp * extension);
- frame->components[1].data = COG_OFFSET (frame->regions[0],
- frame->components[0].length +
- frame->components[1].stride * extension + bytes_pp * extension);
- frame->components[2].data = COG_OFFSET (frame->regions[0],
- frame->components[0].length + frame->components[1].length +
- frame->components[2].stride * extension + bytes_pp * extension);
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_YUY2:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in YUY2 format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_YUY2 (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_YUYV;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].format = frame->format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_POW2 (width, 1) * 2;
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride * height;
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_YUY2:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in UYVY format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_UYVY (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_UYVY;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].format = frame->format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_POW2 (width, 1) * 2;
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride * height;
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_YUY2:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in UYVY format,
- * although the row stride is allowed to be different than what
- * would normally be calculated from @width.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_UYVY_full (void *data, int width, int height,
- int stride)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_UYVY;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = stride;
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride * height;
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_AYUV:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in AYUV format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_AYUV (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_AYUV;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].format = frame->format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = width * 4;
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride * height;
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_v216:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in v216 format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_v216 (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_v216;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].format = frame->format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_POW2 (width, 1) * 4;
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride * height;
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_v210:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in v210 format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_v210 (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_v210;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].format = frame->format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ((width + 47) / 48) * 128;
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride * height;
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_I420:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in I420 format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_I420 (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_U8_420;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].format = frame->format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_POW2 (width, 2);
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride *
- ROUND_UP_POW2 (frame->components[0].height, 1);
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- frame->components[1].format = frame->format;
- frame->components[1].width = ROUND_UP_SHIFT (width, 1);
- frame->components[1].height = ROUND_UP_SHIFT (height, 1);
- frame->components[1].stride = ROUND_UP_POW2 (frame->components[1].width, 2);
- frame->components[1].length =
- frame->components[1].stride * frame->components[1].height;
- frame->components[1].data =
- COG_OFFSET (frame->components[0].data, frame->components[0].length);
- frame->components[1].v_shift = 1;
- frame->components[1].h_shift = 1;
-
- frame->components[2].format = frame->format;
- frame->components[2].width = ROUND_UP_SHIFT (width, 1);
- frame->components[2].height = ROUND_UP_SHIFT (height, 1);
- frame->components[2].stride = ROUND_UP_POW2 (frame->components[2].width, 2);
- frame->components[2].length =
- frame->components[2].stride * frame->components[2].height;
- frame->components[2].data =
- COG_OFFSET (frame->components[1].data, frame->components[1].length);
- frame->components[2].v_shift = 1;
- frame->components[2].h_shift = 1;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_YV12:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in YV12 format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_YV12 (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_U8_420;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].format = frame->format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_POW2 (width, 2);
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride *
- ROUND_UP_POW2 (frame->components[0].height, 1);
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- frame->components[2].format = frame->format;
- frame->components[2].width = ROUND_UP_SHIFT (width, 1);
- frame->components[2].height = ROUND_UP_SHIFT (height, 1);
- frame->components[2].stride = ROUND_UP_POW2 (frame->components[2].width, 2);
- frame->components[2].length =
- frame->components[2].stride * frame->components[2].height;
- frame->components[2].data =
- COG_OFFSET (frame->components[0].data, frame->components[0].length);
- frame->components[2].v_shift = 1;
- frame->components[2].h_shift = 1;
-
- frame->components[1].format = frame->format;
- frame->components[1].width = ROUND_UP_SHIFT (width, 1);
- frame->components[1].height = ROUND_UP_SHIFT (height, 1);
- frame->components[1].stride = ROUND_UP_POW2 (frame->components[1].width, 2);
- frame->components[1].length =
- frame->components[1].stride * frame->components[1].height;
- frame->components[1].data =
- COG_OFFSET (frame->components[2].data, frame->components[2].length);
- frame->components[1].v_shift = 1;
- frame->components[1].h_shift = 1;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_Y42B:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in Y42B format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_Y42B (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_U8_422;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].format = frame->format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_POW2 (width, 2);
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride *
- ROUND_UP_POW2 (frame->components[0].height, 1);
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- frame->components[1].format = frame->format;
- frame->components[1].width = ROUND_UP_SHIFT (width, 1);
- frame->components[1].height = height;
- frame->components[1].stride = ROUND_UP_POW2 (frame->components[1].width, 2);
- frame->components[1].length =
- frame->components[1].stride * frame->components[1].height;
- frame->components[1].data =
- COG_OFFSET (frame->components[0].data, frame->components[0].length);
- frame->components[1].v_shift = 0;
- frame->components[1].h_shift = 1;
-
- frame->components[2].format = frame->format;
- frame->components[2].width = ROUND_UP_SHIFT (width, 1);
- frame->components[2].height = height;
- frame->components[2].stride = ROUND_UP_POW2 (frame->components[2].width, 2);
- frame->components[2].length =
- frame->components[2].stride * frame->components[2].height;
- frame->components[2].data =
- COG_OFFSET (frame->components[1].data, frame->components[1].length);
- frame->components[2].v_shift = 0;
- frame->components[2].h_shift = 1;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_Y444:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in Y444 format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_Y444 (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_U8_444;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].format = frame->format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_POW2 (width, 4);
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride *
- ROUND_UP_POW2 (frame->components[0].height, 1);
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- frame->components[1].format = frame->format;
- frame->components[1].width = width;
- frame->components[1].height = height;
- frame->components[1].stride = ROUND_UP_POW2 (width, 4);
- frame->components[1].length =
- frame->components[1].stride * frame->components[1].height;
- frame->components[1].data =
- COG_OFFSET (frame->components[0].data, frame->components[0].length);
- frame->components[1].v_shift = 0;
- frame->components[1].h_shift = 0;
-
- frame->components[2].format = frame->format;
- frame->components[2].width = width;
- frame->components[2].height = height;
- frame->components[2].stride = ROUND_UP_POW2 (width, 4);
- frame->components[2].length =
- frame->components[2].stride * frame->components[2].height;
- frame->components[2].data =
- COG_OFFSET (frame->components[1].data, frame->components[1].length);
- frame->components[2].v_shift = 0;
- frame->components[2].h_shift = 0;
-
- return frame;
-}
-
-/**
- * cog_frame_new_from_data_RGB:
- *
- * Creates a new CogFrame object with the requested size using
- * the data pointed to by @data. The data must be in RGB format.
- * The data must remain for the lifetime of the CogFrame object.
- * It is recommended to use cog_frame_set_free_callback() for
- * notification when the data is no longer needed.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_new_from_data_RGB (void *data, int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = COG_FRAME_FORMAT_RGB;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_4 (width * 3);
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride * height;
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- return frame;
-}
-
-static CogFrame *
-cog_frame_new_from_data_RGB32 (void *data, int width, int height, int format)
-{
- CogFrame *frame = cog_frame_new ();
-
- frame->format = format;
-
- frame->width = width;
- frame->height = height;
-
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = width * 4;
- frame->components[0].data = data;
- frame->components[0].length = frame->components[0].stride * height;
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- return frame;
-}
-
-CogFrame *
-cog_frame_new_from_data_RGBx (void *data, int width, int height)
-{
- return cog_frame_new_from_data_RGB32 (data, width, height,
- COG_FRAME_FORMAT_RGBx);
-}
-
-CogFrame *
-cog_frame_new_from_data_xRGB (void *data, int width, int height)
-{
- return cog_frame_new_from_data_RGB32 (data, width, height,
- COG_FRAME_FORMAT_xRGB);
-}
-
-CogFrame *
-cog_frame_new_from_data_BGRx (void *data, int width, int height)
-{
- return cog_frame_new_from_data_RGB32 (data, width, height,
- COG_FRAME_FORMAT_BGRx);
-}
-
-CogFrame *
-cog_frame_new_from_data_xBGR (void *data, int width, int height)
-{
- return cog_frame_new_from_data_RGB32 (data, width, height,
- COG_FRAME_FORMAT_xBGR);
-}
-
-CogFrame *
-cog_frame_new_from_data_RGBA (void *data, int width, int height)
-{
- return cog_frame_new_from_data_RGB32 (data, width, height,
- COG_FRAME_FORMAT_RGBA);
-}
-
-CogFrame *
-cog_frame_new_from_data_ARGB (void *data, int width, int height)
-{
- return cog_frame_new_from_data_RGB32 (data, width, height,
- COG_FRAME_FORMAT_ARGB);
-}
-
-CogFrame *
-cog_frame_new_from_data_BGRA (void *data, int width, int height)
-{
- return cog_frame_new_from_data_RGB32 (data, width, height,
- COG_FRAME_FORMAT_BGRA);
-}
-
-CogFrame *
-cog_frame_new_from_data_ABGR (void *data, int width, int height)
-{
- return cog_frame_new_from_data_RGB32 (data, width, height,
- COG_FRAME_FORMAT_ABGR);
-}
-
-/**
- * cog_frame_dup:
- *
- * Creates a new CogFrame object with the same dimensions and format
- * as @frame, and copies the data from the @frame to the new object.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_dup (CogFrame * frame)
-{
- return cog_frame_dup_extended (frame, 0);
-}
-
-CogFrame *
-cog_frame_dup_extended (CogFrame * frame, int extension)
-{
- CogFrame *dup_frame;
-
- dup_frame = cog_frame_new_and_alloc_extended (frame->domain,
- frame->format, frame->width, frame->height, extension);
- cog_frame_convert (dup_frame, frame);
-
- return dup_frame;
-}
-
-/**
- * cog_frame_clone:
- *
- * Creates a new CogFrame object with the same dimensions and format
- * as @frame. This function leaves the data in the new object
- * uninitialized.
- *
- * Returns: a new CogFrame object
- */
-CogFrame *
-cog_frame_clone (CogMemoryDomain * domain, CogFrame * frame)
-{
- return cog_frame_new_and_alloc (domain,
- frame->format, frame->width, frame->height);
-}
-
-/**
- * cog_frame_ref:
- * @frame: a frame object
- *
- * Increases the reference count of @frame.
- *
- * Returns: the value of @frame
- */
-CogFrame *
-cog_frame_ref (CogFrame * frame)
-{
- frame->refcount++;
- return frame;
-}
-
-/**
- * cog_frame_unref:
- * @frame: a frame object
- *
- * Decreases the reference count of @frame. If the new reference
- * count is 0, the frame is freed. If a frame free callback was
- * set, this function is called.
- *
- * Returns: the value of @frame
- */
-void
-cog_frame_unref (CogFrame * frame)
-{
- int i;
-
- g_return_if_fail (frame->refcount > 0);
-
- frame->refcount--;
- if (frame->refcount == 0) {
- if (frame->free) {
- frame->free (frame, frame->priv);
- }
-#ifdef HAVE_OPENGL
- if (COG_FRAME_IS_OPENGL (frame)) {
- cog_opengl_frame_cleanup (frame);
- }
-#endif
-
- for (i = 0; i < 3; i++) {
- if (frame->regions[i]) {
- g_free (frame->regions[i]);
- }
- }
-
- if (frame->virt_frame1) {
- cog_frame_unref (frame->virt_frame1);
- }
- if (frame->virt_frame2) {
- cog_frame_unref (frame->virt_frame2);
- }
- if (frame->virt_priv) {
- g_free (frame->virt_priv);
- }
-
- g_free (frame);
- }
-}
-
-/**
- * cog_frame_set_free_callback:
- * @frame: a frame object
- * @free_func: the function to call when the frame is freed
- * @priv: callback key
- *
- * Sets a function that will be called when the object reference
- * count drops to zero and the object is freed.
- */
-void
-cog_frame_set_free_callback (CogFrame * frame,
- CogFrameFreeFunc free_func, void *priv)
-{
- frame->free = free_func;
- frame->priv = priv;
-}
-
-/**
- * cog_frame_convert:
- * @dest: destination frame
- * @src: source frame
- *
- * Copies data from the source frame to the destination frame, converting
- * formats if necessary. Only a few conversions are supported.
- */
-void
-cog_frame_convert (CogFrame * dest, CogFrame * src)
-{
- CogFrame *frame;
- CogFrameFormat dest_format;
-
- g_return_if_fail (dest != NULL);
- g_return_if_fail (src != NULL);
-
- switch (dest->format) {
- case COG_FRAME_FORMAT_YUYV:
- case COG_FRAME_FORMAT_UYVY:
- dest_format = COG_FRAME_FORMAT_U8_422;
- break;
- case COG_FRAME_FORMAT_AYUV:
- case COG_FRAME_FORMAT_ARGB:
- dest_format = COG_FRAME_FORMAT_U8_444;
- break;
- default:
- dest_format = dest->format;
- break;
- }
- cog_frame_ref (src);
-
- frame = cog_virt_frame_new_unpack (src);
- GST_DEBUG ("unpack %p", frame);
-
- if (COG_FRAME_FORMAT_DEPTH (dest_format) !=
- COG_FRAME_FORMAT_DEPTH (frame->format)) {
- if (COG_FRAME_FORMAT_DEPTH (dest_format) == COG_FRAME_FORMAT_DEPTH_U8) {
- frame = cog_virt_frame_new_convert_u8 (frame);
- GST_DEBUG ("convert_u8 %p", frame);
- } else if (COG_FRAME_FORMAT_DEPTH (dest_format) ==
- COG_FRAME_FORMAT_DEPTH_S16) {
- frame = cog_virt_frame_new_convert_s16 (frame);
- GST_DEBUG ("convert_s16 %p", frame);
- }
- }
-
- if ((dest_format & 3) != (frame->format & 3)) {
- frame = cog_virt_frame_new_subsample (frame, dest_format,
- COG_CHROMA_SITE_MPEG2, 2);
- GST_DEBUG ("subsample %p", frame);
- }
-
- switch (dest->format) {
- case COG_FRAME_FORMAT_YUYV:
- frame = cog_virt_frame_new_pack_YUY2 (frame);
- GST_DEBUG ("pack_YUY2 %p", frame);
- break;
- case COG_FRAME_FORMAT_UYVY:
- frame = cog_virt_frame_new_pack_UYVY (frame);
- GST_DEBUG ("pack_UYVY %p", frame);
- break;
- case COG_FRAME_FORMAT_AYUV:
- frame = cog_virt_frame_new_pack_AYUV (frame);
- GST_DEBUG ("pack_AYUV %p", frame);
- break;
- default:
- break;
- }
-
- if (dest->width < frame->width || dest->height < frame->height) {
- GST_DEBUG ("crop %d %d to %d %d",
- frame->width, frame->height, dest->width, dest->height);
-
- frame = cog_virt_frame_new_crop (frame, dest->width, dest->height);
- GST_DEBUG ("crop %p", frame);
- }
- if (dest->width > src->width || dest->height > src->height) {
- frame = cog_virt_frame_new_edgeextend (frame, dest->width, dest->height);
- GST_DEBUG ("edgeextend %p", frame);
- }
-
- cog_virt_frame_render (frame, dest);
- cog_frame_unref (frame);
-
-}
-
-
-#if 0
-void
-cog_frame_md5 (CogFrame * frame, uint32_t * state)
-{
- uint8_t *line;
- int x, y, k;
-
- state[0] = 0x67452301;
- state[1] = 0xefcdab89;
- state[2] = 0x98badcfe;
- state[3] = 0x10325476;
-
- x = 0;
- y = 0;
- k = 0;
- for (k = 0; k < 3; k++) {
- for (y = 0; y < frame->components[k].height; y++) {
- line = COG_FRAME_DATA_GET_LINE (&frame->components[k], y);
- for (x = 0; x + 63 < frame->components[k].width; x += 64) {
- oil_md5 (state, (uint32_t *) (line + x));
- }
- if (x < frame->components[k].width) {
- uint8_t tmp[64];
- int left;
- left = frame->components[k].width - x;
- memcpy (tmp, line + x, left);
- memset (tmp + left, 0, 64 - left);
- oil_md5 (state, (uint32_t *) tmp);
- }
- }
- }
-
- GST_DEBUG
- ("md5 %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
- state[0] & 0xff, (state[0] >> 8) & 0xff, (state[0] >> 16) & 0xff,
- (state[0] >> 24) & 0xff, state[1] & 0xff, (state[1] >> 8) & 0xff,
- (state[1] >> 16) & 0xff, (state[1] >> 24) & 0xff, state[2] & 0xff,
- (state[2] >> 8) & 0xff, (state[2] >> 16) & 0xff, (state[2] >> 24) & 0xff,
- state[3] & 0xff, (state[3] >> 8) & 0xff, (state[3] >> 16) & 0xff,
- (state[3] >> 24) & 0xff);
-}
-#endif
-
-void
-cog_frame_split_fields (CogFrame * dest1, CogFrame * dest2, CogFrame * src)
-{
- CogFrame src_tmp;
-
- g_return_if_fail ((src->height & 1) == 0);
-
- memcpy (&src_tmp, src, sizeof (src_tmp));
-
- src_tmp.height = src->height / 2;
- src_tmp.components[0].stride *= 2;
- src_tmp.components[1].stride *= 2;
- src_tmp.components[2].stride *= 2;
-
- cog_frame_convert (dest1, &src_tmp);
-
- src_tmp.components[0].data = COG_FRAME_DATA_GET_LINE (&src->components[0], 1);
- src_tmp.components[1].data = COG_FRAME_DATA_GET_LINE (&src->components[1], 1);
- src_tmp.components[2].data = COG_FRAME_DATA_GET_LINE (&src->components[2], 1);
-
- cog_frame_convert (dest2, &src_tmp);
-}
-
-void
-cog_frame_get_subdata (CogFrame * frame, CogFrameData * fd,
- int component, int x, int y)
-{
- CogFrameData *comp = frame->components + component;
-
- g_return_if_fail (COG_FRAME_FORMAT_DEPTH (comp->format) ==
- COG_FRAME_FORMAT_DEPTH_U8);
-
- fd->format = comp->format;
- fd->data = COG_FRAME_DATA_GET_PIXEL_U8 (comp, x, y);
- fd->stride = comp->stride;
- fd->width = MAX (0, comp->width - x);
- fd->height = MAX (0, comp->height - y);
- fd->h_shift = comp->h_shift;
- fd->v_shift = comp->v_shift;
-}
diff --git a/ext/cog/cogframe.h b/ext/cog/cogframe.h
deleted file mode 100644
index a1b013ed1..000000000
--- a/ext/cog/cogframe.h
+++ /dev/null
@@ -1,208 +0,0 @@
-
-#ifndef __COG_FRAME_H__
-#define __COG_FRAME_H__
-
-#include <cog/cogutils.h>
-
-COG_BEGIN_DECLS
-
-typedef struct _CogFrame CogFrame;
-typedef struct _CogFrameData CogFrameData;
-typedef struct _CogUpsampledFrame CogUpsampledFrame;
-
-typedef void (*CogFrameFreeFunc)(CogFrame *frame, void *priv);
-typedef void (*CogFrameRenderFunc)(CogFrame *frame, void *dest, int component, int i);
-
-typedef enum _CogColorMatrix {
- COG_COLOR_MATRIX_UNKNOWN = 0,
- COG_COLOR_MATRIX_HDTV,
- COG_COLOR_MATRIX_SDTV
-} CogColorMatrix;
-
-typedef enum _CogChromaSite {
- COG_CHROMA_SITE_UNKNOWN = 0,
- COG_CHROMA_SITE_MPEG2 = 1,
- COG_CHROMA_SITE_JPEG
-} CogChromaSite;
-
-/* bit pattern:
- * 0x100 - 0: normal, 1: indirect (packed)
- * 0x001 - horizontal chroma subsampling: 0: 1, 1: 2
- * 0x002 - vertical chroma subsampling: 0: 1, 1: 2
- * 0x00c - depth: 0: u8, 1: s16, 2: s32
- * */
-typedef enum _CogFrameFormat {
- COG_FRAME_FORMAT_U8_444 = 0x00,
- COG_FRAME_FORMAT_U8_422 = 0x01,
- COG_FRAME_FORMAT_U8_420 = 0x03,
-
- COG_FRAME_FORMAT_S16_444 = 0x04,
- COG_FRAME_FORMAT_S16_422 = 0x05,
- COG_FRAME_FORMAT_S16_420 = 0x07,
-
- COG_FRAME_FORMAT_S32_444 = 0x08,
- COG_FRAME_FORMAT_S32_422 = 0x09,
- COG_FRAME_FORMAT_S32_420 = 0x0b,
-
- /* indirectly supported */
- COG_FRAME_FORMAT_YUYV = 0x100, /* YUYV order */
- COG_FRAME_FORMAT_UYVY = 0x101, /* UYVY order */
- COG_FRAME_FORMAT_AYUV = 0x102,
- COG_FRAME_FORMAT_RGB = 0x104,
- COG_FRAME_FORMAT_v216 = 0x105,
- COG_FRAME_FORMAT_v210 = 0x106,
- COG_FRAME_FORMAT_RGBx = 0x110,
- COG_FRAME_FORMAT_xRGB = 0x111,
- COG_FRAME_FORMAT_BGRx = 0x112,
- COG_FRAME_FORMAT_xBGR = 0x113,
- COG_FRAME_FORMAT_RGBA = 0x114,
- COG_FRAME_FORMAT_ARGB = 0x115,
- COG_FRAME_FORMAT_BGRA = 0x116,
- COG_FRAME_FORMAT_ABGR = 0x117,
-} CogFrameFormat;
-
-#define COG_FRAME_FORMAT_DEPTH(format) ((format) & 0xc)
-#define COG_FRAME_FORMAT_DEPTH_U8 0x00
-#define COG_FRAME_FORMAT_DEPTH_S16 0x04
-#define COG_FRAME_FORMAT_DEPTH_S32 0x08
-
-#define COG_FRAME_FORMAT_H_SHIFT(format) ((format) & 0x1)
-#define COG_FRAME_FORMAT_V_SHIFT(format) (((format)>>1) & 0x1)
-
-#define COG_FRAME_IS_PACKED(format) (((format)>>8) & 0x1)
-
-#define COG_FRAME_CACHE_SIZE 8
-
-struct _CogFrameData {
- CogFrameFormat format;
- void *data;
- int stride;
- int width;
- int height;
- int length;
- int h_shift;
- int v_shift;
-};
-
-struct _CogFrame {
- int refcount;
- CogFrameFreeFunc free;
- CogMemoryDomain *domain;
- void *regions[3];
- void *priv;
-
- CogFrameFormat format;
- int width;
- int height;
-
- CogFrameData components[3];
-
- int is_virtual;
- int cache_offset[3];
- int cached_lines[3][COG_FRAME_CACHE_SIZE];
- CogFrame *virt_frame1;
- CogFrame *virt_frame2;
- void (*render_line) (CogFrame *frame, void *dest, int component, int i);
- void *virt_priv;
- void *virt_priv2;
- int param1;
- int param2;
-
- int extension;
-};
-
-struct _CogUpsampledFrame {
- CogFrame *frames[4];
- void *components[3];
-};
-
-#define COG_FRAME_DATA_GET_LINE(fd,i) (COG_OFFSET((fd)->data,(fd)->stride*(i)))
-#define COG_FRAME_DATA_GET_PIXEL_U8(fd,i,j) ((uint8_t *)COG_OFFSET((fd)->data,(fd)->stride*(j)+(i)))
-#define COG_FRAME_DATA_GET_PIXEL_S16(fd,i,j) ((int16_t *)COG_OFFSET((fd)->data,(fd)->stride*(j)+(i)*sizeof(int16_t)))
-
-CogFrame * cog_frame_new (void);
-CogFrame * cog_frame_new_and_alloc (CogMemoryDomain *domain,
- CogFrameFormat format, int width, int height);
-CogFrame * cog_frame_new_from_data_I420 (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_YV12 (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_YUY2 (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_UYVY (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_UYVY_full (void *data, int width, int height, int stride);
-CogFrame * cog_frame_new_from_data_AYUV (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_v216 (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_v210 (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_Y42B (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_Y444 (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_RGB (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_RGBx (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_xRGB (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_BGRx (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_xBGR (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_RGBA (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_ARGB (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_BGRA (void *data, int width, int height);
-CogFrame * cog_frame_new_from_data_ABGR (void *data, int width, int height);
-void cog_frame_set_free_callback (CogFrame *frame,
- CogFrameFreeFunc free_func, void *priv);
-void cog_frame_unref (CogFrame *frame);
-CogFrame *cog_frame_ref (CogFrame *frame);
-CogFrame *cog_frame_dup (CogFrame *frame);
-CogFrame *cog_frame_clone (CogMemoryDomain *domain, CogFrame *frame);
-
-void cog_frame_convert (CogFrame *dest, CogFrame *src);
-void cog_frame_add (CogFrame *dest, CogFrame *src);
-void cog_frame_subtract (CogFrame *dest, CogFrame *src);
-void cog_frame_shift_left (CogFrame *frame, int shift);
-void cog_frame_shift_right (CogFrame *frame, int shift);
-
-//void cog_frame_downsample (CogFrame *dest, CogFrame *src);
-void cog_frame_upsample_horiz (CogFrame *dest, CogFrame *src);
-void cog_frame_upsample_vert (CogFrame *dest, CogFrame *src);
-double cog_frame_calculate_average_luma (CogFrame *frame);
-
-CogFrame * cog_frame_convert_to_444 (CogFrame *frame);
-void cog_frame_md5 (CogFrame *frame, uint32_t *state);
-
-CogFrame * cog_frame_new_and_alloc_extended (CogMemoryDomain *domain,
- CogFrameFormat format, int width, int height, int extension);
-CogFrame *cog_frame_dup_extended (CogFrame *frame, int extension);
-void cog_frame_edge_extend (CogFrame *frame, int width, int height);
-void cog_frame_zero_extend (CogFrame *frame, int width, int height);
-void cog_frame_mark (CogFrame *frame, int value);
-void cog_frame_mc_edgeextend (CogFrame *frame);
-
-void cog_frame_data_get_codeblock (CogFrameData *dest, CogFrameData *src,
- int x, int y, int horiz_codeblocks, int vert_codeblocks);
-
-CogUpsampledFrame * cog_upsampled_frame_new (CogFrame *frame);
-void cog_upsampled_frame_free (CogUpsampledFrame *df);
-void cog_upsampled_frame_upsample (CogUpsampledFrame *df);
-#ifdef ENABLE_MOTION_REF
-int cog_upsampled_frame_get_pixel_prec0 (CogUpsampledFrame *upframe, int k,
- int x, int y);
-int cog_upsampled_frame_get_pixel_prec1 (CogUpsampledFrame *upframe, int k,
- int x, int y);
-int cog_upsampled_frame_get_pixel_prec3 (CogUpsampledFrame *upframe, int k,
- int x, int y);
-int cog_upsampled_frame_get_pixel_precN (CogUpsampledFrame *upframe, int k,
- int x, int y, int mv_precision);
-#endif
-void cog_upsampled_frame_get_block_precN (CogUpsampledFrame *upframe, int k,
- int x, int y, int prec, CogFrameData *dest);
-void cog_upsampled_frame_get_block_fast_precN (CogUpsampledFrame *upframe, int k,
- int x, int y, int prec, CogFrameData *dest, CogFrameData *fd);
-void cog_upsampled_frame_get_subdata_prec0 (CogUpsampledFrame *upframe,
- int k, int x, int y, CogFrameData *fd);
-void cog_upsampled_frame_get_subdata_prec1 (CogUpsampledFrame *upframe,
- int k, int x, int y, CogFrameData *fd);
-
-void cog_frame_get_subdata (CogFrame *frame, CogFrameData *fd,
- int comp, int x, int y);
-
-void cog_frame_split_fields (CogFrame *dest1, CogFrame *dest2, CogFrame *src);
-
-
-COG_END_DECLS
-
-#endif
-
diff --git a/ext/cog/cogtables.c b/ext/cog/cogtables.c
deleted file mode 100644
index e83ba227a..000000000
--- a/ext/cog/cogtables.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/* This file is autogenerated. Do not edit.*/
-#include <glib.h>
-gint8 cog_resample_table_4tap[256][4] = {
- {0, 64, 0, 0}
- , /* 0.000 0.000 0.000 -0.000 64 */
- {0, 64, 0, 0}
- , /* -0.248 -0.002 0.251 -0.001 64 */
- {0, 64, 0, 0}
- , /* -0.492 -0.008 0.504 -0.004 64 */
- {-1, 64, 1, 0}
- , /* 0.267 -0.017 -0.241 -0.009 64 */
- {-1, 64, 1, 0}
- , /* 0.031 -0.031 0.015 -0.015 64 */
- {-1, 64, 1, 0}
- , /* -0.202 -0.048 0.274 -0.024 64 */
- {-1, 64, 1, 0}
- , /* -0.431 -0.069 0.534 -0.034 64 */
- {-2, 64, 2, 0}
- , /* 0.344 -0.094 -0.203 -0.047 64 */
- {-2, 64, 2, 0}
- , /* 0.123 -0.123 0.061 -0.061 64 */
- {-2, 64, 2, 0}
- , /* -0.095 -0.155 0.326 -0.076 64 */
- {-2, 64, 2, 0}
- , /* -0.309 -0.191 0.594 -0.094 64 */
- {-3, 64, 3, 0}
- , /* 0.481 -0.231 -0.137 -0.113 64 */
- {-3, 64, 3, 0}
- , /* 0.275 -0.275 0.134 -0.134 64 */
- {-3, 64, 3, 0}
- , /* 0.072 -0.322 0.407 -0.157 64 */
- {-3, 63, 4, 0}
- , /* -0.128 0.628 -0.319 -0.181 64 */
- {-3, 63, 4, 0}
- , /* -0.323 0.573 -0.043 -0.207 64 */
- {-4, 64, 4, 0}
- , /* 0.484 -0.484 0.234 -0.234 64 */
- {-4, 63, 5, 0}
- , /* 0.296 0.454 -0.487 -0.263 64 */
- {-4, 63, 5, 0}
- , /* 0.111 0.389 -0.206 -0.294 64 */
- {-4, 63, 5, 0}
- , /* -0.071 0.321 0.076 -0.326 64 */
- {-4, 63, 5, 0}
- , /* -0.249 0.249 0.360 -0.360 64 */
- {-5, 63, 6, 0}
- , /* 0.576 0.174 -0.355 -0.395 64 */
- {-5, 63, 6, 0}
- , /* 0.405 0.095 -0.068 -0.432 64 */
- {-5, 63, 6, 0}
- , /* 0.237 0.013 0.220 -0.470 64 */
- {-5, 63, 7, -1}
- , /* 0.072 -0.072 -0.490 0.490 64 */
- {-5, 63, 7, -1}
- , /* -0.089 -0.161 -0.199 0.449 64 */
- {-5, 63, 7, -1}
- , /* -0.247 -0.253 0.093 0.407 64 */
- {-5, 63, 7, -1}
- , /* -0.401 -0.349 0.387 0.363 64 */
- {-6, 63, 8, -1}
- , /* 0.448 -0.448 -0.318 0.318 64 */
- {-6, 63, 8, -1}
- , /* 0.300 -0.550 -0.022 0.272 64 */
- {-6, 63, 8, -1}
- , /* 0.155 -0.655 0.276 0.224 64 */
- {-6, 62, 9, -1}
- , /* 0.013 0.237 -0.425 0.175 64 */
- {-6, 62, 9, -1}
- , /* -0.125 0.125 -0.125 0.125 64 */
- {-6, 62, 9, -1}
- , /* -0.260 0.010 0.176 0.074 64 */
- {-6, 62, 9, -1}
- , /* -0.392 -0.108 0.479 0.021 64 */
- {-7, 62, 10, -1}
- , /* 0.479 -0.229 -0.217 -0.033 64 */
- {-7, 62, 10, -1}
- , /* 0.353 -0.353 0.088 -0.088 64 */
- {-7, 62, 10, -1}
- , /* 0.231 -0.481 0.394 -0.144 64 */
- {-7, 61, 11, -1}
- , /* 0.111 0.389 -0.299 -0.201 64 */
- {-7, 61, 11, -1}
- , /* -0.006 0.256 0.009 -0.259 64 */
- {-7, 61, 11, -1}
- , /* -0.119 0.119 0.318 -0.318 64 */
- {-7, 61, 12, -2}
- , /* -0.230 -0.020 -0.371 0.621 64 */
- {-7, 61, 12, -2}
- , /* -0.337 -0.163 -0.060 0.560 64 */
- {-7, 61, 12, -2}
- , /* -0.442 -0.308 0.252 0.498 64 */
- {-8, 61, 13, -2}
- , /* 0.456 -0.456 -0.434 0.434 64 */
- {-8, 61, 13, -2}
- , /* 0.357 -0.607 -0.120 0.370 64 */
- {-8, 60, 13, -1}
- , /* 0.262 0.238 0.195 -0.695 64 */
- {-8, 60, 14, -2}
- , /* 0.168 0.082 -0.489 0.239 64 */
- {-8, 60, 14, -2}
- , /* 0.078 -0.078 -0.172 0.172 64 */
- {-8, 60, 14, -2}
- , /* -0.009 -0.241 0.146 0.104 64 */
- {-8, 60, 14, -2}
- , /* -0.094 -0.406 0.465 0.035 64 */
- {-8, 59, 15, -2}
- , /* -0.176 0.426 -0.216 -0.034 64 */
- {-8, 59, 15, -2}
- , /* -0.255 0.255 0.104 -0.104 64 */
- {-8, 59, 15, -2}
- , /* -0.332 0.082 0.425 -0.175 64 */
- {-9, 59, 16, -2}
- , /* 0.595 -0.095 -0.253 -0.247 64 */
- {-9, 59, 16, -2}
- , /* 0.524 -0.274 0.069 -0.319 64 */
- {-9, 59, 16, -2}
- , /* 0.455 -0.455 0.393 -0.393 64 */
- {-9, 58, 17, -2}
- , /* 0.389 0.361 -0.284 -0.466 64 */
- {-9, 58, 17, -2}
- , /* 0.326 0.174 0.041 -0.541 64 */
- {-9, 58, 17, -2}
- , /* 0.265 -0.015 0.366 -0.616 64 */
- {-9, 58, 18, -3}
- , /* 0.207 -0.207 -0.308 0.308 64 */
- {-9, 58, 18, -3}
- , /* 0.152 -0.402 0.018 0.232 64 */
- {-9, 58, 18, -3}
- , /* 0.099 -0.599 0.345 0.155 64 */
- {-9, 57, 19, -3}
- , /* 0.048 0.202 -0.328 0.078 64 */
- {-9, 57, 19, -3}
- , /* 0.000 0.000 0.000 0.000 64 */
- {-9, 57, 19, -3}
- , /* -0.046 -0.204 0.328 -0.078 64 */
- {-9, 56, 20, -3}
- , /* -0.089 0.589 -0.343 -0.157 64 */
- {-9, 56, 20, -3}
- , /* -0.130 0.380 -0.014 -0.236 64 */
- {-9, 56, 20, -3}
- , /* -0.168 0.168 0.316 -0.316 64 */
- {-9, 56, 21, -4}
- , /* -0.204 -0.046 -0.354 0.604 64 */
- {-9, 56, 21, -4}
- , /* -0.238 -0.262 -0.023 0.523 64 */
- {-9, 56, 21, -4}
- , /* -0.270 -0.480 0.308 0.442 64 */
- {-9, 55, 22, -4}
- , /* -0.299 0.299 -0.361 0.361 64 */
- {-9, 55, 22, -4}
- , /* -0.326 0.076 -0.030 0.280 64 */
- {-9, 55, 22, -4}
- , /* -0.350 -0.150 0.302 0.198 64 */
- {-9, 54, 23, -4}
- , /* -0.373 0.623 -0.366 0.116 64 */
- {-9, 54, 23, -4}
- , /* -0.393 0.393 -0.034 0.034 64 */
- {-9, 54, 23, -4}
- , /* -0.411 0.161 0.299 -0.049 64 */
- {-10, 54, 24, -4}
- , /* 0.573 -0.073 -0.369 -0.131 64 */
- {-10, 54, 24, -4}
- , /* 0.559 -0.309 -0.036 -0.214 64 */
- {-9, 53, 24, -4}
- , /* -0.453 0.453 0.297 -0.297 64 */
- {-10, 53, 25, -4}
- , /* 0.537 0.213 -0.370 -0.380 64 */
- {-10, 53, 25, -4}
- , /* 0.530 -0.030 -0.037 -0.463 64 */
- {-9, 53, 25, -5}
- , /* -0.476 -0.274 0.296 0.454 64 */
- {-9, 52, 26, -5}
- , /* -0.480 0.480 -0.370 0.370 64 */
- {-9, 52, 26, -5}
- , /* -0.481 0.231 -0.037 0.287 64 */
- {-9, 52, 26, -5}
- , /* -0.481 -0.019 0.296 0.204 64 */
- {-10, 52, 27, -5}
- , /* 0.521 -0.271 -0.370 0.120 64 */
- {-9, 51, 27, -5}
- , /* -0.475 0.475 -0.037 0.037 64 */
- {-9, 51, 27, -5}
- , /* -0.469 0.219 0.296 -0.046 64 */
- {-10, 51, 28, -5}
- , /* 0.539 -0.039 -0.371 -0.129 64 */
- {-10, 51, 28, -5}
- , /* 0.549 -0.299 -0.038 -0.212 64 */
- {-9, 50, 28, -5}
- , /* -0.439 0.439 0.295 -0.295 64 */
- {-10, 50, 29, -5}
- , /* 0.574 0.176 -0.372 -0.378 64 */
- {-9, 50, 29, -6}
- , /* -0.411 -0.089 -0.040 0.540 64 */
- {-9, 50, 29, -6}
- , /* -0.394 -0.356 0.293 0.457 64 */
- {-9, 49, 30, -6}
- , /* -0.375 0.375 -0.375 0.375 64 */
- {-9, 49, 30, -6}
- , /* -0.355 0.105 -0.043 0.293 64 */
- {-9, 49, 30, -6}
- , /* -0.333 -0.167 0.289 0.211 64 */
- {-9, 48, 31, -6}
- , /* -0.309 0.559 -0.380 0.130 64 */
- {-9, 48, 31, -6}
- , /* -0.283 0.283 -0.049 0.049 64 */
- {-9, 48, 31, -6}
- , /* -0.256 0.006 0.282 -0.032 64 */
- {-9, 48, 31, -6}
- , /* -0.228 -0.272 0.612 -0.112 64 */
- {-9, 47, 32, -6}
- , /* -0.198 0.448 -0.058 -0.192 64 */
- {-9, 47, 32, -6}
- , /* -0.166 0.166 0.271 -0.271 64 */
- {-9, 47, 32, -6}
- , /* -0.133 -0.117 0.601 -0.351 64 */
- {-9, 47, 33, -7}
- , /* -0.098 -0.402 -0.071 0.571 64 */
- {-9, 46, 33, -6}
- , /* -0.062 0.312 0.257 -0.507 64 */
- {-9, 46, 34, -7}
- , /* -0.024 0.024 -0.415 0.415 64 */
- {-9, 46, 34, -7}
- , /* 0.015 -0.265 -0.088 0.338 64 */
- {-9, 46, 34, -7}
- , /* 0.055 -0.555 0.239 0.261 64 */
- {-9, 45, 35, -7}
- , /* 0.097 0.153 -0.435 0.185 64 */
- {-9, 45, 35, -7}
- , /* 0.141 -0.141 -0.109 0.109 64 */
- {-9, 45, 35, -7}
- , /* 0.185 -0.435 0.216 0.034 64 */
- {-9, 44, 36, -7}
- , /* 0.231 0.269 -0.460 -0.040 64 */
- {-9, 44, 36, -7}
- , /* 0.278 -0.028 -0.137 -0.113 64 */
- {-9, 44, 36, -7}
- , /* 0.327 -0.327 0.186 -0.186 64 */
- {-9, 43, 37, -7}
- , /* 0.377 0.373 -0.492 -0.258 64 */
- {-9, 43, 37, -7}
- , /* 0.428 0.072 -0.170 -0.330 64 */
- {-9, 43, 37, -7}
- , /* 0.480 -0.230 0.151 -0.401 64 */
- {-8, 42, 37, -7}
- , /* -0.467 0.467 0.471 -0.471 64 */
- {-8, 42, 38, -8}
- , /* -0.412 0.162 -0.210 0.460 64 */
- {-8, 42, 38, -8}
- , /* -0.357 -0.143 0.108 0.392 64 */
- {-8, 42, 38, -8}
- , /* -0.300 -0.450 0.426 0.324 64 */
- {-8, 41, 39, -8}
- , /* -0.242 0.242 -0.258 0.258 64 */
- {-8, 41, 39, -8}
- , /* -0.183 -0.067 0.058 0.192 64 */
- {-8, 41, 39, -8}
- , /* -0.123 -0.377 0.373 0.127 64 */
- {-8, 40, 40, -8}
- , /* -0.062 0.312 -0.313 0.063 64 */
- {-8, 40, 40, -8}
- , /* 0.000 0.000 0.000 0.000 64 */
- {-8, 40, 40, -8}
- , /* 0.063 -0.313 0.312 -0.062 64 */
- {-8, 39, 41, -8}
- , /* 0.127 0.373 -0.377 -0.123 64 */
- {-8, 39, 41, -8}
- , /* 0.192 0.058 -0.067 -0.183 64 */
- {-8, 39, 41, -8}
- , /* 0.258 -0.258 0.242 -0.242 64 */
- {-8, 38, 42, -8}
- , /* 0.324 0.426 -0.450 -0.300 64 */
- {-8, 38, 42, -8}
- , /* 0.392 0.108 -0.143 -0.357 64 */
- {-8, 38, 42, -8}
- , /* 0.460 -0.210 0.162 -0.412 64 */
- {-7, 37, 42, -8}
- , /* -0.471 0.471 0.467 -0.467 64 */
- {-7, 37, 43, -9}
- , /* -0.401 0.151 -0.230 0.480 64 */
- {-7, 37, 43, -9}
- , /* -0.330 -0.170 0.072 0.428 64 */
- {-7, 37, 43, -9}
- , /* -0.258 -0.492 0.373 0.377 64 */
- {-7, 36, 44, -9}
- , /* -0.186 0.186 -0.327 0.327 64 */
- {-7, 36, 44, -9}
- , /* -0.113 -0.137 -0.028 0.278 64 */
- {-7, 36, 44, -9}
- , /* -0.040 -0.460 0.269 0.231 64 */
- {-7, 35, 45, -9}
- , /* 0.034 0.216 -0.435 0.185 64 */
- {-7, 35, 45, -9}
- , /* 0.109 -0.109 -0.141 0.141 64 */
- {-7, 35, 45, -9}
- , /* 0.185 -0.435 0.153 0.097 64 */
- {-7, 34, 46, -9}
- , /* 0.261 0.239 -0.555 0.055 64 */
- {-7, 34, 46, -9}
- , /* 0.338 -0.088 -0.265 0.015 64 */
- {-7, 34, 46, -9}
- , /* 0.415 -0.415 0.024 -0.024 64 */
- {-6, 33, 46, -9}
- , /* -0.507 0.257 0.312 -0.062 64 */
- {-7, 33, 47, -9}
- , /* 0.571 -0.071 -0.402 -0.098 64 */
- {-6, 32, 47, -9}
- , /* -0.351 0.601 -0.117 -0.133 64 */
- {-6, 32, 47, -9}
- , /* -0.271 0.271 0.166 -0.166 64 */
- {-6, 32, 47, -9}
- , /* -0.192 -0.058 0.448 -0.198 64 */
- {-6, 31, 48, -9}
- , /* -0.112 0.612 -0.272 -0.228 64 */
- {-6, 31, 48, -9}
- , /* -0.032 0.282 0.006 -0.256 64 */
- {-6, 31, 48, -9}
- , /* 0.049 -0.049 0.283 -0.283 64 */
- {-6, 31, 48, -9}
- , /* 0.130 -0.380 0.559 -0.309 64 */
- {-6, 30, 49, -9}
- , /* 0.211 0.289 -0.167 -0.333 64 */
- {-6, 30, 49, -9}
- , /* 0.293 -0.043 0.105 -0.355 64 */
- {-6, 30, 49, -9}
- , /* 0.375 -0.375 0.375 -0.375 64 */
- {-6, 29, 50, -9}
- , /* 0.457 0.293 -0.356 -0.394 64 */
- {-6, 29, 50, -9}
- , /* 0.540 -0.040 -0.089 -0.411 64 */
- {-5, 29, 50, -10}
- , /* -0.378 -0.372 0.176 0.574 64 */
- {-5, 28, 50, -9}
- , /* -0.295 0.295 0.439 -0.439 64 */
- {-5, 28, 51, -10}
- , /* -0.212 -0.038 -0.299 0.549 64 */
- {-5, 28, 51, -10}
- , /* -0.129 -0.371 -0.039 0.539 64 */
- {-5, 27, 51, -9}
- , /* -0.046 0.296 0.219 -0.469 64 */
- {-5, 27, 51, -9}
- , /* 0.037 -0.037 0.475 -0.475 64 */
- {-5, 27, 52, -10}
- , /* 0.120 -0.370 -0.271 0.521 64 */
- {-5, 26, 52, -9}
- , /* 0.204 0.296 -0.019 -0.481 64 */
- {-5, 26, 52, -9}
- , /* 0.287 -0.037 0.231 -0.481 64 */
- {-5, 26, 52, -9}
- , /* 0.370 -0.370 0.480 -0.480 64 */
- {-5, 25, 53, -9}
- , /* 0.454 0.296 -0.274 -0.476 64 */
- {-4, 25, 53, -10}
- , /* -0.463 -0.037 -0.030 0.530 64 */
- {-4, 25, 53, -10}
- , /* -0.380 -0.370 0.213 0.537 64 */
- {-4, 24, 53, -9}
- , /* -0.297 0.297 0.453 -0.453 64 */
- {-4, 24, 54, -10}
- , /* -0.214 -0.036 -0.309 0.559 64 */
- {-4, 24, 54, -10}
- , /* -0.131 -0.369 -0.073 0.573 64 */
- {-4, 23, 54, -9}
- , /* -0.049 0.299 0.161 -0.411 64 */
- {-4, 23, 54, -9}
- , /* 0.034 -0.034 0.393 -0.393 64 */
- {-4, 23, 54, -9}
- , /* 0.116 -0.366 0.623 -0.373 64 */
- {-4, 22, 55, -9}
- , /* 0.198 0.302 -0.150 -0.350 64 */
- {-4, 22, 55, -9}
- , /* 0.280 -0.030 0.076 -0.326 64 */
- {-4, 22, 55, -9}
- , /* 0.361 -0.361 0.299 -0.299 64 */
- {-4, 21, 56, -9}
- , /* 0.442 0.308 -0.480 -0.270 64 */
- {-4, 21, 56, -9}
- , /* 0.523 -0.023 -0.262 -0.238 64 */
- {-4, 21, 56, -9}
- , /* 0.604 -0.354 -0.046 -0.204 64 */
- {-3, 20, 56, -9}
- , /* -0.316 0.316 0.168 -0.168 64 */
- {-3, 20, 56, -9}
- , /* -0.236 -0.014 0.380 -0.130 64 */
- {-3, 20, 56, -9}
- , /* -0.157 -0.343 0.589 -0.089 64 */
- {-3, 19, 57, -9}
- , /* -0.078 0.328 -0.204 -0.046 64 */
- {-3, 19, 57, -9}
- , /* 0.000 0.000 0.000 0.000 64 */
- {-3, 19, 57, -9}
- , /* 0.078 -0.328 0.202 0.048 64 */
- {-3, 18, 58, -9}
- , /* 0.155 0.345 -0.599 0.099 64 */
- {-3, 18, 58, -9}
- , /* 0.232 0.018 -0.402 0.152 64 */
- {-3, 18, 58, -9}
- , /* 0.308 -0.308 -0.207 0.207 64 */
- {-2, 17, 58, -9}
- , /* -0.616 0.366 -0.015 0.265 64 */
- {-2, 17, 58, -9}
- , /* -0.541 0.041 0.174 0.326 64 */
- {-2, 17, 58, -9}
- , /* -0.466 -0.284 0.361 0.389 64 */
- {-2, 16, 59, -9}
- , /* -0.393 0.393 -0.455 0.455 64 */
- {-2, 16, 59, -9}
- , /* -0.319 0.069 -0.274 0.524 64 */
- {-2, 16, 59, -9}
- , /* -0.247 -0.253 -0.095 0.595 64 */
- {-2, 15, 59, -8}
- , /* -0.175 0.425 0.082 -0.332 64 */
- {-2, 15, 59, -8}
- , /* -0.104 0.104 0.255 -0.255 64 */
- {-2, 15, 59, -8}
- , /* -0.034 -0.216 0.426 -0.176 64 */
- {-2, 14, 60, -8}
- , /* 0.035 0.465 -0.406 -0.094 64 */
- {-2, 14, 60, -8}
- , /* 0.104 0.146 -0.241 -0.009 64 */
- {-2, 14, 60, -8}
- , /* 0.172 -0.172 -0.078 0.078 64 */
- {-2, 14, 60, -8}
- , /* 0.239 -0.489 0.082 0.168 64 */
- {-1, 13, 60, -8}
- , /* -0.695 0.195 0.238 0.262 64 */
- {-2, 13, 61, -8}
- , /* 0.370 -0.120 -0.607 0.357 64 */
- {-2, 13, 61, -8}
- , /* 0.434 -0.434 -0.456 0.456 64 */
- {-2, 12, 61, -7}
- , /* 0.498 0.252 -0.308 -0.442 64 */
- {-2, 12, 61, -7}
- , /* 0.560 -0.060 -0.163 -0.337 64 */
- {-2, 12, 61, -7}
- , /* 0.621 -0.371 -0.020 -0.230 64 */
- {-1, 11, 61, -7}
- , /* -0.318 0.318 0.119 -0.119 64 */
- {-1, 11, 61, -7}
- , /* -0.259 0.009 0.256 -0.006 64 */
- {-1, 11, 61, -7}
- , /* -0.201 -0.299 0.389 0.111 64 */
- {-1, 10, 62, -7}
- , /* -0.144 0.394 -0.481 0.231 64 */
- {-1, 10, 62, -7}
- , /* -0.088 0.088 -0.353 0.353 64 */
- {-1, 10, 62, -7}
- , /* -0.033 -0.217 -0.229 0.479 64 */
- {-1, 9, 62, -6}
- , /* 0.021 0.479 -0.108 -0.392 64 */
- {-1, 9, 62, -6}
- , /* 0.074 0.176 0.010 -0.260 64 */
- {-1, 9, 62, -6}
- , /* 0.125 -0.125 0.125 -0.125 64 */
- {-1, 9, 62, -6}
- , /* 0.175 -0.425 0.237 0.013 64 */
- {-1, 8, 63, -6}
- , /* 0.224 0.276 -0.655 0.155 64 */
- {-1, 8, 63, -6}
- , /* 0.272 -0.022 -0.550 0.300 64 */
- {-1, 8, 63, -6}
- , /* 0.318 -0.318 -0.448 0.448 64 */
- {-1, 7, 63, -5}
- , /* 0.363 0.387 -0.349 -0.401 64 */
- {-1, 7, 63, -5}
- , /* 0.407 0.093 -0.253 -0.247 64 */
- {-1, 7, 63, -5}
- , /* 0.449 -0.199 -0.161 -0.089 64 */
- {-1, 7, 63, -5}
- , /* 0.490 -0.490 -0.072 0.072 64 */
- {0, 6, 63, -5}
- , /* -0.470 0.220 0.013 0.237 64 */
- {0, 6, 63, -5}
- , /* -0.432 -0.068 0.095 0.405 64 */
- {0, 6, 63, -5}
- , /* -0.395 -0.355 0.174 0.576 64 */
- {0, 5, 63, -4}
- , /* -0.360 0.360 0.249 -0.249 64 */
- {0, 5, 63, -4}
- , /* -0.326 0.076 0.321 -0.071 64 */
- {0, 5, 63, -4}
- , /* -0.294 -0.206 0.389 0.111 64 */
- {0, 5, 63, -4}
- , /* -0.263 -0.487 0.454 0.296 64 */
- {0, 4, 64, -4}
- , /* -0.234 0.234 -0.484 0.484 64 */
- {0, 4, 63, -3}
- , /* -0.207 -0.043 0.573 -0.323 64 */
- {0, 4, 63, -3}
- , /* -0.181 -0.319 0.628 -0.128 64 */
- {0, 3, 64, -3}
- , /* -0.157 0.407 -0.322 0.072 64 */
- {0, 3, 64, -3}
- , /* -0.134 0.134 -0.275 0.275 64 */
- {0, 3, 64, -3}
- , /* -0.113 -0.137 -0.231 0.481 64 */
- {0, 2, 64, -2}
- , /* -0.094 0.594 -0.191 -0.309 64 */
- {0, 2, 64, -2}
- , /* -0.076 0.326 -0.155 -0.095 64 */
- {0, 2, 64, -2}
- , /* -0.061 0.061 -0.123 0.123 64 */
- {0, 2, 64, -2}
- , /* -0.047 -0.203 -0.094 0.344 64 */
- {0, 1, 64, -1}
- , /* -0.034 0.534 -0.069 -0.431 64 */
- {0, 1, 64, -1}
- , /* -0.024 0.274 -0.048 -0.202 64 */
- {0, 1, 64, -1}
- , /* -0.015 0.015 -0.031 0.031 64 */
- {0, 1, 64, -1}
- , /* -0.009 -0.241 -0.017 0.267 64 */
- {0, 0, 64, 0}
- , /* -0.004 0.504 -0.008 -0.492 64 */
- {0, 0, 64, 0}
- , /* -0.001 0.251 -0.002 -0.248 64 */
-};
diff --git a/ext/cog/cogutils.h b/ext/cog/cogutils.h
deleted file mode 100644
index 6d09757ce..000000000
--- a/ext/cog/cogutils.h
+++ /dev/null
@@ -1,108 +0,0 @@
-
-#ifndef __COG_UTILS_H__
-#define __COG_UTILS_H__
-
-#if defined(_MSC_VER)
-#ifndef COG_NO_STDINT_TYPEDEFS
-typedef __int8 int8_t;
-typedef __int16 int16_t;
-typedef __int32 int32_t;
-typedef unsigned __int8 uint8_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int32 uint32_t;
-#endif
-#else
-#include "_stdint.h"
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-typedef void CogMemoryDomain;
-typedef unsigned int cog_bool;
-
-#ifdef COG_ENABLE_UNSTABLE_API
-
-#define COG_PICTURE_NUMBER_INVALID (-1)
-
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-#define DIVIDE_ROUND_UP(a,b) (((a) + (b) - 1)/(b))
-#ifndef MIN
-#define MIN(a,b) ((a)<(b) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a,b) ((a)>(b) ? (a) : (b))
-#endif
-#ifndef CLAMP
-#define CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
-#endif
-#define NEED_CLAMP(x,y,a,b) ((x) < (a) || (y) > (b))
-#define ROUND_UP_SHIFT(x,y) (((x) + (1<<(y)) - 1)>>(y))
-#define ROUND_UP_POW2(x,y) (((x) + (1<<(y)) - 1)&((~0)<<(y)))
-#define ROUND_UP_2(x) ROUND_UP_POW2(x,1)
-#define ROUND_UP_4(x) ROUND_UP_POW2(x,2)
-#define ROUND_UP_8(x) ROUND_UP_POW2(x,3)
-#define ROUND_UP_64(x) ROUND_UP_POW2(x,6)
-#define OFFSET(ptr,offset) ((void *)(((uint8_t *)(ptr)) + (offset)))
-#define ROUND_SHIFT(x,y) (((x) + (1<<((y)-1)))>>(y))
-
-#define cog_divide(a,b) (((a)<0)?(((a) - (b) + 1)/(b)):((a)/(b)))
-
-#endif
-
-#define COG_OFFSET(ptr,offset) ((void *)(((uint8_t *)(ptr)) + (offset)))
-#define COG_GET(ptr, offset, type) (*(type *)((uint8_t *)(ptr) + (offset)) )
-
-#if defined(__GNUC__) && defined(__GNUC_MINOR__)
-#define COG_GNUC_PREREQ(maj, min) \
- ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-#else
-#define COG_GNUC_PREREQ(maj, min) 0
-#endif
-
-#if COG_GNUC_PREREQ(3,3) && defined(__ELF__)
-#define COG_INTERNAL __attribute__ ((visibility ("internal")))
-#else
-#define COG_INTERNAL
-#endif
-
-#ifdef __cplusplus
-#define COG_BEGIN_DECLS extern "C" {
-#define COG_END_DECLS }
-#else
-#define COG_BEGIN_DECLS
-#define COG_END_DECLS
-#endif
-
-
-COG_BEGIN_DECLS
-
-void * cog_malloc (int size);
-void * cog_malloc0 (int size);
-void * cog_realloc (void *ptr, int size);
-void cog_free (void *ptr);
-
-int cog_utils_multiplier_to_quant_index (double x);
-int cog_dequantise (int q, int quant_factor, int quant_offset);
-int cog_quantise (int value, int quant_factor, int quant_offset);
-void cog_quantise_s16 (int16_t *dest, int16_t *src, int quant_factor,
- int quant_offset, int n);
-void cog_quantise_s16_table (int16_t *dest, int16_t *src, int quant_index,
- cog_bool is_intra, int n);
-void cog_dequantise_s16 (int16_t *dest, int16_t *src, int quant_factor,
- int quant_offset, int n);
-void cog_dequantise_s16_table (int16_t *dest, int16_t *src, int quant_index,
- cog_bool is_intra, int n);
-double cog_utils_probability_to_entropy (double x);
-double cog_utils_entropy (double a, double total);
-void cog_utils_reduce_fraction (int *n, int *d);
-double cog_utils_get_time (void);
-
-COG_END_DECLS
-
-#endif
-
diff --git a/ext/cog/cogvirtframe.c b/ext/cog/cogvirtframe.c
deleted file mode 100644
index e6d08e551..000000000
--- a/ext/cog/cogvirtframe.c
+++ /dev/null
@@ -1,2200 +0,0 @@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define COG_ENABLE_UNSTABLE_API 1
-
-#include <cog/cogvirtframe.h>
-#include <cog/cog.h>
-#include <string.h>
-#include <math.h>
-#ifdef HAVE_ORC
-#include <orc/orc.h>
-#else
-#define orc_memcpy memcpy
-#endif
-#include <gst/gst.h>
-
-#include "gstcogorc.h"
-
-extern gint8 cog_resample_table_4tap[256][4];
-
-CogFrame *
-cog_frame_new_virtual (CogMemoryDomain * domain, CogFrameFormat format,
- int width, int height)
-{
- CogFrame *frame = cog_frame_new ();
- int bytes_pp;
- int h_shift, v_shift;
- int chroma_width;
- int chroma_height;
- int i;
-
- frame->format = format;
- frame->width = width;
- frame->height = height;
- frame->domain = domain;
-
- if (COG_FRAME_IS_PACKED (format)) {
- frame->components[0].format = format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- if (format == COG_FRAME_FORMAT_AYUV) {
- frame->components[0].stride = width * 4;
- } else if (format == COG_FRAME_FORMAT_v216) {
- frame->components[0].stride = ROUND_UP_POW2 (width, 1) * 4;
- } else if (format == COG_FRAME_FORMAT_v210) {
- frame->components[0].stride = ((width + 47) / 48) * 128;
- } else {
- frame->components[0].stride = ROUND_UP_POW2 (width, 1) * 2;
- }
- frame->components[0].length = frame->components[0].stride * height;
-
- frame->components[0].data = frame->regions[0];
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- frame->regions[0] =
- g_malloc (frame->components[0].stride * COG_FRAME_CACHE_SIZE);
- for (i = 0; i < COG_FRAME_CACHE_SIZE; i++) {
- frame->cached_lines[0][i] = 0;
- }
- frame->cache_offset[0] = 0;
- frame->is_virtual = TRUE;
-
- return frame;
- }
-
- switch (COG_FRAME_FORMAT_DEPTH (format)) {
- case COG_FRAME_FORMAT_DEPTH_U8:
- bytes_pp = 1;
- break;
- case COG_FRAME_FORMAT_DEPTH_S16:
- bytes_pp = 2;
- break;
- case COG_FRAME_FORMAT_DEPTH_S32:
- bytes_pp = 4;
- break;
- default:
- g_return_val_if_reached (NULL);
- bytes_pp = 0;
- break;
- }
-
- h_shift = COG_FRAME_FORMAT_H_SHIFT (format);
- v_shift = COG_FRAME_FORMAT_V_SHIFT (format);
- chroma_width = ROUND_UP_SHIFT (width, h_shift);
- chroma_height = ROUND_UP_SHIFT (height, v_shift);
-
- frame->components[0].format = format;
- frame->components[0].width = width;
- frame->components[0].height = height;
- frame->components[0].stride = ROUND_UP_4 (width * bytes_pp);
- frame->components[0].length =
- frame->components[0].stride * frame->components[0].height;
- frame->components[0].v_shift = 0;
- frame->components[0].h_shift = 0;
-
- frame->components[1].format = format;
- frame->components[1].width = chroma_width;
- frame->components[1].height = chroma_height;
- frame->components[1].stride = ROUND_UP_4 (chroma_width * bytes_pp);
- frame->components[1].length =
- frame->components[1].stride * frame->components[1].height;
- frame->components[1].v_shift = v_shift;
- frame->components[1].h_shift = h_shift;
-
- frame->components[2].format = format;
- frame->components[2].width = chroma_width;
- frame->components[2].height = chroma_height;
- frame->components[2].stride = ROUND_UP_4 (chroma_width * bytes_pp);
- frame->components[2].length =
- frame->components[2].stride * frame->components[2].height;
- frame->components[2].v_shift = v_shift;
- frame->components[2].h_shift = h_shift;
-
- for (i = 0; i < 3; i++) {
- CogFrameData *comp = &frame->components[i];
- int j;
-
- frame->regions[i] = g_malloc (comp->stride * COG_FRAME_CACHE_SIZE);
- for (j = 0; j < COG_FRAME_CACHE_SIZE; j++) {
- frame->cached_lines[i][j] = 0;
- }
- frame->cache_offset[i] = 0;
- }
- frame->is_virtual = TRUE;
-
- return frame;
-}
-
-void *
-cog_virt_frame_get_line (CogFrame * frame, int component, int i)
-{
- CogFrameData *comp = &frame->components[component];
- int j;
-
- g_return_val_if_fail (i >= 0, NULL);
- g_return_val_if_fail (i < comp->height, NULL);
-
- if (!frame->is_virtual) {
- return COG_FRAME_DATA_GET_LINE (&frame->components[component], i);
- }
-
- if (i < frame->cache_offset[component]) {
- if (i != 0) {
- g_warning ("cache failure: %d outside [%d,%d]", i,
- frame->cache_offset[component],
- frame->cache_offset[component] + COG_FRAME_CACHE_SIZE - 1);
- }
-
- frame->cache_offset[component] = i;
- for (j = 0; j < COG_FRAME_CACHE_SIZE; j++) {
- frame->cached_lines[component][j] = 0;
- }
- }
-
- while (i >= frame->cache_offset[component] + COG_FRAME_CACHE_SIZE) {
- j = frame->cache_offset[component] & (COG_FRAME_CACHE_SIZE - 1);
- frame->cached_lines[component][j] = 0;
-
- frame->cache_offset[component]++;
- }
-
- j = i & (COG_FRAME_CACHE_SIZE - 1);
- if (!frame->cached_lines[component][j]) {
- cog_virt_frame_render_line (frame,
- COG_OFFSET (frame->regions[component], comp->stride * j), component, i);
- frame->cached_lines[component][j] = 1;
- }
-
- return COG_OFFSET (frame->regions[component], comp->stride * j);
-}
-
-void
-cog_virt_frame_render_line (CogFrame * frame, void *dest, int component, int i)
-{
- frame->render_line (frame, dest, component, i);
-}
-
-static void
-copy (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
-
- src = cog_virt_frame_get_line (frame, component, i);
- switch (COG_FRAME_FORMAT_DEPTH (frame->format)) {
- case COG_FRAME_FORMAT_DEPTH_U8:
- orc_memcpy (dest, src, frame->components[component].width);
- break;
- case COG_FRAME_FORMAT_DEPTH_S16:
- orc_memcpy (dest, src, frame->components[component].width * 2);
- break;
- default:
- g_return_if_reached ();
- break;
- }
-}
-
-void
-cog_virt_frame_render (CogFrame * frame, CogFrame * dest)
-{
- int i, k;
-
- g_return_if_fail (frame->width == dest->width);
- g_return_if_fail (frame->height >= dest->height);
-
- if (frame->is_virtual) {
- for (k = 0; k < 3; k++) {
- CogFrameData *comp = dest->components + k;
-
- for (i = 0; i < dest->components[k].height; i++) {
- cog_virt_frame_render_line (frame,
- COG_FRAME_DATA_GET_LINE (comp, i), k, i);
- }
- }
- } else {
- for (k = 0; k < 3; k++) {
- CogFrameData *comp = dest->components + k;
-
- for (i = 0; i < dest->components[k].height; i++) {
- copy (frame, COG_FRAME_DATA_GET_LINE (comp, i), k, i);
- }
- }
- }
-}
-
-static void
-cog_virt_frame_render_downsample_horiz_cosite_3tap (CogFrame * frame,
- void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int n_src;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- n_src = frame->virt_frame1->components[component].width;
-
- cogorc_downsample_horiz_cosite_3tap (dest + 1,
- (uint16_t *) (src + 1), (uint16_t *) (src + 3),
- frame->components[component].width - 1);
-
- {
- int j;
- int x;
-
- j = 0;
- x = 1 * src[CLAMP (j * 2 - 1, 0, n_src - 1)];
- x += 2 * src[CLAMP (j * 2 + 0, 0, n_src - 1)];
- x += 1 * src[CLAMP (j * 2 + 1, 0, n_src - 1)];
- dest[j] = CLAMP ((x + 2) >> 2, 0, 255);
-
-#if 0
- j = frame->components[component].width - 1;
- x = 1 * src[CLAMP (j * 2 - 1, 0, n_src - 1)];
- x += 2 * src[CLAMP (j * 2 + 0, 0, n_src - 1)];
- x += 1 * src[CLAMP (j * 2 + 1, 0, n_src - 1)];
- dest[j] = CLAMP ((x + 2) >> 2, 0, 255);
-#endif
- }
-}
-
-static void
-cog_virt_frame_render_downsample_horiz_halfsite (CogFrame * frame,
- void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int j;
- int n_src;
- int taps = 4;
- int k;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- n_src = frame->virt_frame1->components[component].width;
-
- switch (taps) {
- case 4:
- for (j = 0; j < frame->components[component].width; j++) {
- int x = 0;
- x += 6 * src[CLAMP (j * 2 - 1, 0, n_src - 1)];
- x += 26 * src[CLAMP (j * 2 + 0, 0, n_src - 1)];
- x += 26 * src[CLAMP (j * 2 + 1, 0, n_src - 1)];
- x += 6 * src[CLAMP (j * 2 + 2, 0, n_src - 1)];
- dest[j] = CLAMP ((x + 32) >> 6, 0, 255);
- }
- break;
- case 6:
- for (j = 0; j < frame->components[component].width; j++) {
- int x = 0;
- x += -3 * src[CLAMP (j * 2 - 2, 0, n_src - 1)];
- x += 8 * src[CLAMP (j * 2 - 1, 0, n_src - 1)];
- x += 27 * src[CLAMP (j * 2 + 0, 0, n_src - 1)];
- x += 27 * src[CLAMP (j * 2 + 1, 0, n_src - 1)];
- x += 8 * src[CLAMP (j * 2 + 2, 0, n_src - 1)];
- x += -3 * src[CLAMP (j * 2 + 3, 0, n_src - 1)];
- dest[j] = CLAMP ((x + 32) >> 6, 0, 255);
- }
- case 8:
- for (j = 0; j < frame->components[component].width; j++) {
- int x = 0;
- const int taps8[8] = { -2, -4, 9, 29, 29, 9, -4, -2 };
- for (k = 0; k < 8; k++) {
- x += taps8[k] * src[CLAMP (j * 2 - 3 + k, 0, n_src - 1)];
- }
- dest[j] = CLAMP ((x + 32) >> 6, 0, 255);
- }
- break;
- case 10:
- for (j = 0; j < frame->components[component].width; j++) {
- int x = 0;
- const int taps10[10] = { 1, -2, -5, 9, 29, 29, 9, -5, -2, 1 };
- for (k = 0; k < 10; k++) {
- x += taps10[k] * src[CLAMP (j * 2 - 4 + k, 0, n_src - 1)];
- }
- dest[j] = CLAMP ((x + 32) >> 6, 0, 255);
- }
- break;
- default:
- break;
- }
-}
-
-CogFrame *
-cog_virt_frame_new_horiz_downsample (CogFrame * vf, int n_taps)
-{
- CogFrame *virt_frame;
-
- virt_frame =
- cog_frame_new_virtual (NULL, vf->format, vf->width / 2, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->param1 = n_taps;
- switch (n_taps) {
- case 3:
- virt_frame->render_line =
- cog_virt_frame_render_downsample_horiz_cosite_3tap;
- break;
- case 4:
- case 6:
- case 8:
- case 10:
- virt_frame->render_line = cog_virt_frame_render_downsample_horiz_halfsite;
- break;
- default:
- g_return_val_if_reached (NULL);
- }
-
- return virt_frame;
-}
-
-static void
-cog_virt_frame_render_downsample_vert_cosite (CogFrame * frame,
- void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- uint8_t *src3;
- int n_src;
-
- n_src = frame->virt_frame1->components[component].height;
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 - 1, 0, n_src - 1));
- src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 0, 0, n_src - 1));
- src3 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 1, 0, n_src - 1));
-
- cogorc_downsample_vert_cosite_3tap (dest, src1, src2, src3,
- frame->components[component].width);
-}
-
-static void
-cog_virt_frame_render_downsample_vert_halfsite_2tap (CogFrame * frame,
- void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- int n_src;
-
- n_src = frame->virt_frame1->components[component].height;
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2, 0, n_src - 1));
- src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 1, 0, n_src - 1));
-
- cogorc_downsample_vert_halfsite_2tap (dest, src1, src2,
- frame->components[component].width);
-}
-
-static void
-cog_virt_frame_render_downsample_vert_halfsite_4tap (CogFrame * frame,
- void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- uint8_t *src3;
- uint8_t *src4;
- int n_src;
-
- n_src = frame->virt_frame1->components[component].height;
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 - 1, 0, n_src - 1));
- src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2, 0, n_src - 1));
- src3 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 1, 0, n_src - 1));
- src4 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 2, 0, n_src - 1));
-
- cogorc_downsample_vert_halfsite_4tap (dest, src1, src2, src3, src4,
- frame->components[component].width);
-}
-
-
-static void
-cog_virt_frame_render_downsample_vert_halfsite (CogFrame * frame,
- void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src[10];
- int j;
- int n_src;
- int taps = frame->param1;
- int k;
-
- n_src = frame->virt_frame1->components[component].height;
- for (j = 0; j < taps; j++) {
- src[j] = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 - (taps - 2) / 2 + j, 0, n_src - 1));
- }
-
- switch (taps) {
- case 4:
- for (j = 0; j < frame->components[component].width; j++) {
- int x = 0;
- x += 6 * src[0][j];
- x += 26 * src[1][j];
- x += 26 * src[2][j];
- x += 6 * src[3][j];
- dest[j] = CLAMP ((x + 32) >> 6, 0, 255);
- }
- break;
- case 6:
- for (j = 0; j < frame->components[component].width; j++) {
- int x = 0;
- x += -3 * src[0][j];
- x += 8 * src[1][j];
- x += 27 * src[2][j];
- x += 27 * src[3][j];
- x += 8 * src[4][j];
- x += -3 * src[5][j];
- dest[j] = CLAMP ((x + 32) >> 6, 0, 255);
- }
- break;
- case 8:
- for (j = 0; j < frame->components[component].width; j++) {
- int x = 0;
- const int taps8[8] = { -2, -4, 9, 29, 29, 9, -4, -2 };
- for (k = 0; k < 8; k++) {
- x += taps8[k] * src[k][j];
- }
- dest[j] = CLAMP ((x + 32) >> 6, 0, 255);
- }
- break;
- case 10:
- for (j = 0; j < frame->components[component].width; j++) {
- int x = 0;
- const int taps10[10] = { 1, -2, -5, 9, 29, 29, 9, -5, -2, 1 };
- for (k = 0; k < 10; k++) {
- x += taps10[k] * src[k][j];
- }
- dest[j] = CLAMP ((x + 32) >> 6, 0, 255);
- }
- break;
- default:
- g_return_if_reached ();
- break;
- }
-}
-
-CogFrame *
-cog_virt_frame_new_vert_downsample (CogFrame * vf, int n_taps)
-{
- CogFrame *virt_frame;
-
- virt_frame =
- cog_frame_new_virtual (NULL, vf->format, vf->width, vf->height / 2);
- virt_frame->virt_frame1 = vf;
- virt_frame->param1 = n_taps;
- switch (n_taps) {
- case 2:
- virt_frame->render_line =
- cog_virt_frame_render_downsample_vert_halfsite_2tap;
- break;
- case 3:
- virt_frame->render_line = cog_virt_frame_render_downsample_vert_cosite;
- break;
- case 4:
- virt_frame->render_line =
- cog_virt_frame_render_downsample_vert_halfsite_4tap;
- break;
- default:
- virt_frame->render_line = cog_virt_frame_render_downsample_vert_halfsite;
- break;
- }
-
- return virt_frame;
-}
-
-static void
-cog_virt_frame_render_resample_vert_1tap (CogFrame * frame, void *_dest,
- int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- int n_src;
- int scale = frame->param1;
- int acc;
- int src_i;
-
- acc = scale * i;
- src_i = acc >> 8;
- /* x = acc & 0xff; */
-
- n_src = frame->virt_frame1->components[component].height;
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (src_i + 0, 0, n_src - 1));
-
- orc_memcpy (dest, src1, frame->components[component].width);
-}
-
-static void
-cog_virt_frame_render_resample_vert_2tap (CogFrame * frame, void *_dest,
- int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- int n_src;
- int scale = frame->param1;
- int acc;
- int x;
- int src_i;
-
- acc = scale * i;
- src_i = acc >> 8;
- x = acc & 0xff;
-
- n_src = frame->virt_frame1->components[component].height;
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (src_i + 0, 0, n_src - 1));
- src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (src_i + 1, 0, n_src - 1));
-
- if (x == 0) {
- memcpy (dest, src1, frame->components[component].width);
- } else {
- cogorc_combine2_u8 (dest, src1, src2,
- 256 - x, x, frame->components[component].width);
- }
-}
-
-static void
-cog_virt_frame_render_resample_vert_4tap (CogFrame * frame, void *_dest,
- int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- uint8_t *src3;
- uint8_t *src4;
- int n_src;
- int scale = frame->param1;
- int acc;
- int x;
- int src_i;
-
- acc = scale * i;
- src_i = acc >> 8;
- x = acc & 0xff;
-
- n_src = frame->virt_frame1->components[component].height;
- if (src_i < 1 || src_i >= n_src - 3) {
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (src_i - 1, 0, n_src - 1));
- src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (src_i + 0, 0, n_src - 1));
- src3 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (src_i + 1, 0, n_src - 1));
- src4 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (src_i + 2, 0, n_src - 1));
- } else {
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component, src_i - 1);
- src2 = cog_virt_frame_get_line (frame->virt_frame1, component, src_i + 0);
- src3 = cog_virt_frame_get_line (frame->virt_frame1, component, src_i + 1);
- src4 = cog_virt_frame_get_line (frame->virt_frame1, component, src_i + 2);
- }
-
- cogorc_combine4_u8 (dest, src1, src2, src3, src4,
- cog_resample_table_4tap[x][0],
- cog_resample_table_4tap[x][1],
- cog_resample_table_4tap[x][2],
- cog_resample_table_4tap[x][3], frame->components[component].width);
-}
-
-CogFrame *
-cog_virt_frame_new_vert_resample (CogFrame * vf, int height, int n_taps)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, vf->format, vf->width, height);
- virt_frame->virt_frame1 = vf;
- if (n_taps == 1) {
- virt_frame->render_line = cog_virt_frame_render_resample_vert_1tap;
- } else if (n_taps == 2) {
- virt_frame->render_line = cog_virt_frame_render_resample_vert_2tap;
- } else {
- virt_frame->render_line = cog_virt_frame_render_resample_vert_4tap;
- }
-
- virt_frame->param1 = 256 * vf->height / height;
-
- return virt_frame;
-}
-
-static void
-cog_virt_frame_render_resample_horiz_1tap (CogFrame * frame, void *_dest,
- int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int scale = frame->param1;
-
- /* n_src = frame->virt_frame1->components[component].width; */
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
-
- cogorc_resample_horiz_1tap (dest, src, 0, scale,
- frame->components[component].width);
-}
-
-static void
-cog_virt_frame_render_resample_horiz_2tap (CogFrame * frame, void *_dest,
- int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int scale = frame->param1;
-
- /* n_src = frame->virt_frame1->components[component].width; */
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
-
- cogorc_resample_horiz_2tap (dest, src, 0, scale,
- frame->components[component].width);
-}
-
-static void
-cog_virt_frame_render_resample_horiz_4tap (CogFrame * frame, void *_dest,
- int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int j;
- int n_src;
- int scale = frame->param1;
- int acc;
-
- n_src = frame->virt_frame1->components[component].width;
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
-
- acc = 0;
- for (j = 0; j < 1; j++) {
- int src_i;
- int y;
- int z;
-
- src_i = acc >> 16;
- y = (acc >> 8) & 255;
-
- z = 32;
- z += cog_resample_table_4tap[y][0] * src[CLAMP (src_i - 1, 0, n_src - 1)];
- z += cog_resample_table_4tap[y][1] * src[CLAMP (src_i + 0, 0, n_src - 1)];
- z += cog_resample_table_4tap[y][2] * src[CLAMP (src_i + 1, 0, n_src - 1)];
- z += cog_resample_table_4tap[y][3] * src[CLAMP (src_i + 2, 0, n_src - 1)];
- z >>= 6;
- dest[j] = CLAMP (z, 0, 255);
- acc += scale;
- }
- for (; j < frame->components[component].width - 2; j++) {
- int src_i;
- int y;
- int z;
-
- src_i = acc >> 16;
- y = (acc >> 8) & 255;
-
- z = 32;
- z += cog_resample_table_4tap[y][0] * src[src_i - 1];
- z += cog_resample_table_4tap[y][1] * src[src_i + 0];
- z += cog_resample_table_4tap[y][2] * src[src_i + 1];
- z += cog_resample_table_4tap[y][3] * src[src_i + 2];
- z >>= 6;
- dest[j] = CLAMP (z, 0, 255);
- acc += scale;
- }
- for (; j < frame->components[component].width; j++) {
- int src_i;
- int y;
- int z;
-
- src_i = acc >> 16;
- y = (acc >> 8) & 255;
-
- z = 32;
- z += cog_resample_table_4tap[y][0] * src[CLAMP (src_i - 1, 0, n_src - 1)];
- z += cog_resample_table_4tap[y][1] * src[CLAMP (src_i + 0, 0, n_src - 1)];
- z += cog_resample_table_4tap[y][2] * src[CLAMP (src_i + 1, 0, n_src - 1)];
- z += cog_resample_table_4tap[y][3] * src[CLAMP (src_i + 2, 0, n_src - 1)];
- z >>= 6;
- dest[j] = CLAMP (z, 0, 255);
- acc += scale;
- }
-}
-
-CogFrame *
-cog_virt_frame_new_horiz_resample (CogFrame * vf, int width, int n_taps)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, vf->format, width, vf->height);
- virt_frame->virt_frame1 = vf;
- if (n_taps == 1) {
- virt_frame->render_line = cog_virt_frame_render_resample_horiz_1tap;
- } else if (n_taps == 2) {
- virt_frame->render_line = cog_virt_frame_render_resample_horiz_2tap;
- } else {
- virt_frame->render_line = cog_virt_frame_render_resample_horiz_4tap;
- }
-
- virt_frame->param1 = 65536 * vf->width / width;
-
- return virt_frame;
-}
-
-static void
-unpack_yuyv (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
-
- switch (component) {
- case 0:
- orc_unpack_yuyv_y (dest, (void *) src, frame->width);
- break;
- case 1:
- orc_unpack_yuyv_u (dest, (void *) src, frame->width / 2);
- break;
- case 2:
- orc_unpack_yuyv_v (dest, (void *) src, frame->width / 2);
- break;
- }
-}
-
-static void
-unpack_uyvy (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
-
- switch (component) {
- case 0:
- orc_unpack_uyvy_y (dest, (void *) src, frame->width);
- break;
- case 1:
- cogorc_unpack_axyz_0 (dest, (void *) src, frame->width / 2);
- break;
- case 2:
- cogorc_unpack_axyz_2 (dest, (void *) src, frame->width / 2);
- break;
- }
-}
-
-static void
-unpack_axyz (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint32_t *src;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
-
- switch ((frame->param1 >> (12 - component * 4)) & 0xf) {
- case 0:
- cogorc_unpack_axyz_0 (dest, src, frame->width);
- break;
- case 1:
- cogorc_unpack_axyz_1 (dest, src, frame->width);
- break;
- case 2:
- cogorc_unpack_axyz_2 (dest, src, frame->width);
- break;
- case 3:
- cogorc_unpack_axyz_3 (dest, src, frame->width);
- break;
- }
-}
-
-static void
-unpack_v210 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int j;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
-
-#define READ_UINT32_LE(a) (((uint8_t *)(a))[0] | (((uint8_t *)(a))[1]<<8) | \
- (((uint8_t *)(a))[2]<<16) | (((uint8_t *)(a))[3]<<24))
- switch (component) {
- case 0:
- for (j = 0; j < frame->width / 6; j++) {
- dest[j * 6 + 0] =
- ((READ_UINT32_LE (src + j * 16 + 0) >> 10) & 0x3ff) >> 2;
- dest[j * 6 + 1] =
- ((READ_UINT32_LE (src + j * 16 + 4) >> 0) & 0x3ff) >> 2;
- dest[j * 6 + 2] =
- ((READ_UINT32_LE (src + j * 16 + 4) >> 20) & 0x3ff) >> 2;
- dest[j * 6 + 3] =
- ((READ_UINT32_LE (src + j * 16 + 8) >> 10) & 0x3ff) >> 2;
- dest[j * 6 + 4] =
- ((READ_UINT32_LE (src + j * 16 + 12) >> 0) & 0x3ff) >> 2;
- dest[j * 6 + 5] =
- ((READ_UINT32_LE (src + j * 16 + 12) >> 20) & 0x3ff) >> 2;
- }
- if (j * 6 + 0 < frame->width) {
- dest[j * 6 + 0] =
- ((READ_UINT32_LE (src + j * 16 + 0) >> 10) & 0x3ff) >> 2;
- }
- if (j * 6 + 1 < frame->width) {
- dest[j * 6 + 1] =
- ((READ_UINT32_LE (src + j * 16 + 4) >> 0) & 0x3ff) >> 2;
- }
- if (j * 6 + 2 < frame->width) {
- dest[j * 6 + 2] =
- ((READ_UINT32_LE (src + j * 16 + 4) >> 20) & 0x3ff) >> 2;
- }
- if (j * 6 + 3 < frame->width) {
- dest[j * 6 + 3] =
- ((READ_UINT32_LE (src + j * 16 + 8) >> 10) & 0x3ff) >> 2;
- }
- if (j * 6 + 4 < frame->width) {
- dest[j * 6 + 4] =
- ((READ_UINT32_LE (src + j * 16 + 12) >> 0) & 0x3ff) >> 2;
- }
- if (j * 6 + 5 < frame->width) {
- dest[j * 6 + 5] =
- ((READ_UINT32_LE (src + j * 16 + 12) >> 20) & 0x3ff) >> 2;
- }
- break;
- case 1:
- for (j = 0; j < frame->width / 6; j++) {
- dest[j * 3 + 0] =
- ((READ_UINT32_LE (src + j * 16 + 0) >> 0) & 0x3ff) >> 2;
- dest[j * 3 + 1] =
- ((READ_UINT32_LE (src + j * 16 + 4) >> 10) & 0x3ff) >> 2;
- dest[j * 3 + 2] =
- ((READ_UINT32_LE (src + j * 16 + 8) >> 20) & 0x3ff) >> 2;
- }
- if (j * 6 + 0 < frame->width) {
- dest[j * 3 + 0] =
- ((READ_UINT32_LE (src + j * 16 + 0) >> 0) & 0x3ff) >> 2;
- }
- if (j * 6 + 2 < frame->width) {
- dest[j * 3 + 1] =
- ((READ_UINT32_LE (src + j * 16 + 4) >> 10) & 0x3ff) >> 2;
- }
- if (j * 6 + 4 < frame->width) {
- dest[j * 3 + 2] =
- ((READ_UINT32_LE (src + j * 16 + 8) >> 20) & 0x3ff) >> 2;
- }
- break;
- case 2:
- for (j = 0; j < frame->width / 6; j++) {
- dest[j * 3 + 0] =
- ((READ_UINT32_LE (src + j * 16 + 0) >> 20) & 0x3ff) >> 2;
- dest[j * 3 + 1] =
- ((READ_UINT32_LE (src + j * 16 + 8) >> 0) & 0x3ff) >> 2;
- dest[j * 3 + 2] =
- ((READ_UINT32_LE (src + j * 16 + 12) >> 10) & 0x3ff) >> 2;
- }
- if (j * 6 + 0 < frame->width) {
- dest[j * 3 + 0] =
- ((READ_UINT32_LE (src + j * 16 + 0) >> 20) & 0x3ff) >> 2;
- }
- if (j * 6 + 2 < frame->width) {
- dest[j * 3 + 1] =
- ((READ_UINT32_LE (src + j * 16 + 8) >> 0) & 0x3ff) >> 2;
- }
- if (j * 6 + 4 < frame->width) {
- dest[j * 3 + 2] =
- ((READ_UINT32_LE (src + j * 16 + 12) >> 10) & 0x3ff) >> 2;
- }
- break;
- }
-}
-
-static void
-unpack_v216 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int j;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
-
- switch (component) {
- case 0:
- for (j = 0; j < frame->width; j++) {
- dest[j] = src[j * 4 + 2 + 1];
- }
- break;
- case 1:
- for (j = 0; j < frame->width / 2; j++) {
- dest[j] = src[j * 8 + 0 + 1];
- }
- break;
- case 2:
- for (j = 0; j < frame->width / 2; j++) {
- dest[j] = src[j * 8 + 4 + 1];
- }
- }
-}
-
-CogFrame *
-cog_virt_frame_new_unpack (CogFrame * vf)
-{
- CogFrame *virt_frame;
- CogFrameFormat format;
- CogFrameRenderFunc render_line;
- int param1 = 0;
-
- if (!COG_FRAME_IS_PACKED (vf->format))
- return vf;
-
- switch (vf->format) {
- case COG_FRAME_FORMAT_YUYV:
- format = COG_FRAME_FORMAT_U8_422;
- render_line = unpack_yuyv;
- break;
- case COG_FRAME_FORMAT_UYVY:
- format = COG_FRAME_FORMAT_U8_422;
- render_line = unpack_uyvy;
- break;
- case COG_FRAME_FORMAT_v210:
- format = COG_FRAME_FORMAT_U8_422;
- render_line = unpack_v210;
- break;
- case COG_FRAME_FORMAT_v216:
- format = COG_FRAME_FORMAT_U8_422;
- render_line = unpack_v216;
- break;
- case COG_FRAME_FORMAT_RGBx:
- case COG_FRAME_FORMAT_RGBA:
- format = COG_FRAME_FORMAT_U8_444;
- render_line = unpack_axyz;
- param1 = 0x0123;
- break;
- case COG_FRAME_FORMAT_BGRx:
- case COG_FRAME_FORMAT_BGRA:
- format = COG_FRAME_FORMAT_U8_444;
- render_line = unpack_axyz;
- param1 = 0x2103;
- break;
- case COG_FRAME_FORMAT_xRGB:
- case COG_FRAME_FORMAT_ARGB:
- case COG_FRAME_FORMAT_AYUV:
- format = COG_FRAME_FORMAT_U8_444;
- render_line = unpack_axyz;
- param1 = 0x1230;
- break;
- case COG_FRAME_FORMAT_xBGR:
- case COG_FRAME_FORMAT_ABGR:
- format = COG_FRAME_FORMAT_U8_444;
- render_line = unpack_axyz;
- param1 = 0x3210;
- break;
- default:
- g_return_val_if_reached (NULL);
- }
-
- virt_frame = cog_frame_new_virtual (NULL, format, vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = render_line;
- virt_frame->param1 = param1;
-
- return virt_frame;
-}
-
-
-static void
-pack_yuyv (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_y;
- uint8_t *src_u;
- uint8_t *src_v;
-
- src_y = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_u = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_v = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_yuyv (dest, src_y, src_u, src_v, frame->width / 2);
-}
-
-
-CogFrame *
-cog_virt_frame_new_pack_YUY2 (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_YUYV,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_yuyv;
-
- return virt_frame;
-}
-
-static void
-pack_uyvy (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_y;
- uint8_t *src_u;
- uint8_t *src_v;
-
- src_y = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_u = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_v = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_uyvy (dest, src_y, src_u, src_v, frame->width / 2);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_UYVY (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_YUYV,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_uyvy;
-
- return virt_frame;
-}
-
-static void
-pack_v216 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src_y;
- uint8_t *src_u;
- uint8_t *src_v;
- int j;
-
- src_y = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_u = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_v = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- for (j = 0; j < frame->width / 2; j++) {
- dest[j * 8 + 0] = src_u[j];
- dest[j * 8 + 1] = src_u[j];
- dest[j * 8 + 2] = src_y[j * 2 + 0];
- dest[j * 8 + 3] = src_y[j * 2 + 0];
- dest[j * 8 + 4] = src_v[j];
- dest[j * 8 + 5] = src_v[j];
- dest[j * 8 + 6] = src_y[j * 2 + 1];
- dest[j * 8 + 7] = src_y[j * 2 + 1];
- }
-}
-
-CogFrame *
-cog_virt_frame_new_pack_v216 (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_v216,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_v216;
-
- return virt_frame;
-}
-
-static void
-pack_v210 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src_y;
- uint8_t *src_u;
- uint8_t *src_v;
- int j;
- uint32_t val;
-
- src_y = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_u = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_v = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
-#define TO_10(x) (((x)<<2) | ((x)>>6))
-#define WRITE_UINT32_LE(a,b) do { \
- ((uint8_t *)(a))[0] = (b)&0xff; \
- ((uint8_t *)(a))[1] = ((b)>>8)&0xff; \
- ((uint8_t *)(a))[2] = ((b)>>16)&0xff; \
- ((uint8_t *)(a))[3] = ((b)>>24)&0xff; \
-} while(0)
- for (j = 0; j < frame->width / 6; j++) {
- int y0, y1, y2, y3, y4, y5;
- int cr0, cr1, cr2;
- int cb0, cb1, cb2;
-
- y0 = TO_10 (src_y[j * 6 + 0]);
- y1 = TO_10 (src_y[j * 6 + 1]);
- y2 = TO_10 (src_y[j * 6 + 2]);
- y3 = TO_10 (src_y[j * 6 + 3]);
- y4 = TO_10 (src_y[j * 6 + 4]);
- y5 = TO_10 (src_y[j * 6 + 5]);
- cb0 = TO_10 (src_u[j * 3 + 0]);
- cb1 = TO_10 (src_u[j * 3 + 1]);
- cb2 = TO_10 (src_u[j * 3 + 2]);
- cr0 = TO_10 (src_v[j * 3 + 0]);
- cr1 = TO_10 (src_v[j * 3 + 1]);
- cr2 = TO_10 (src_v[j * 3 + 2]);
-
- val = (cr0 << 20) | (y0 << 10) | (cb0);
- WRITE_UINT32_LE (dest + j * 16 + 0, val);
-
- val = (y2 << 20) | (cb1 << 10) | (y1);
- WRITE_UINT32_LE (dest + j * 16 + 4, val);
-
- val = (cb2 << 20) | (y3 << 10) | (cr1);
- WRITE_UINT32_LE (dest + j * 16 + 8, val);
-
- val = (y5 << 20) | (cr2 << 10) | (y4);
- WRITE_UINT32_LE (dest + j * 16 + 12, val);
- }
- if (j * 6 < frame->width) {
- int y0, y1, y2, y3, y4, y5;
- int cr0, cr1, cr2;
- int cb0, cb1, cb2;
-
- y0 = ((j * 6 + 0) < frame->width) ? TO_10 (src_y[j * 6 + 0]) : 0;
- y1 = ((j * 6 + 1) < frame->width) ? TO_10 (src_y[j * 6 + 1]) : 0;
- y2 = ((j * 6 + 2) < frame->width) ? TO_10 (src_y[j * 6 + 2]) : 0;
- y3 = ((j * 6 + 3) < frame->width) ? TO_10 (src_y[j * 6 + 3]) : 0;
- y4 = ((j * 6 + 4) < frame->width) ? TO_10 (src_y[j * 6 + 4]) : 0;
- y5 = ((j * 6 + 5) < frame->width) ? TO_10 (src_y[j * 6 + 5]) : 0;
- cb0 = ((j * 6 + 0) < frame->width) ? TO_10 (src_u[j * 3 + 0]) : 0;
- cb1 = ((j * 6 + 2) < frame->width) ? TO_10 (src_u[j * 3 + 1]) : 0;
- cb2 = ((j * 6 + 4) < frame->width) ? TO_10 (src_u[j * 3 + 2]) : 0;
- cr0 = ((j * 6 + 0) < frame->width) ? TO_10 (src_v[j * 3 + 0]) : 0;
- cr1 = ((j * 6 + 2) < frame->width) ? TO_10 (src_v[j * 3 + 1]) : 0;
- cr2 = ((j * 6 + 4) < frame->width) ? TO_10 (src_v[j * 3 + 2]) : 0;
-
- val = (cr0 << 20) | (y0 << 10) | (cb0);
- WRITE_UINT32_LE (dest + j * 16 + 0, val);
-
- val = (y2 << 20) | (cb1 << 10) | (y1);
- WRITE_UINT32_LE (dest + j * 16 + 4, val);
-
- val = (cb2 << 20) | (y3 << 10) | (cr1);
- WRITE_UINT32_LE (dest + j * 16 + 8, val);
-
- val = (y5 << 20) | (cr2 << 10) | (y4);
- WRITE_UINT32_LE (dest + j * 16 + 12, val);
- }
-
-}
-
-CogFrame *
-cog_virt_frame_new_pack_v210 (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_v210,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_v210;
-
- return virt_frame;
-}
-
-static void
-pack_ayuv (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_y;
- uint8_t *src_u;
- uint8_t *src_v;
-
- src_y = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_u = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_v = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_x123 (dest, src_y, src_u, src_v, 0xff, frame->width);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_AYUV (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_AYUV,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_ayuv;
-
- return virt_frame;
-}
-
-static void
-pack_rgb (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src_y;
- uint8_t *src_u;
- uint8_t *src_v;
- int j;
-
- src_y = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_u = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_v = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- for (j = 0; j < frame->width; j++) {
- dest[j * 3 + 0] = src_y[j];
- dest[j * 3 + 1] = src_u[j];
- dest[j * 3 + 2] = src_v[j];
- }
-}
-
-CogFrame *
-cog_virt_frame_new_pack_RGB (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_RGB,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_rgb;
-
- return virt_frame;
-}
-
-
-static const int cog_rgb_to_ycbcr_matrix_8bit_sdtv[] = {
- 66, 129, 25, 4096,
- -38, -74, 112, 32768,
- 112, -94, -18, 32768,
-};
-
-static const int cog_rgb_to_ycbcr_matrix_8bit_hdtv[] = {
- 47, 157, 16, 4096,
- -26, -87, 112, 32768,
- 112, -102, -10, 32768,
-};
-
-static void
-color_matrix_RGB_to_YCbCr (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- uint8_t *src3;
- int *matrix = frame->virt_priv2;
-
- src1 = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src2 = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src3 = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- /* for RGB -> YUV */
- switch (component) {
- case 0:
- orc_matrix3_000_u8 (dest, src1, src2, src3,
- matrix[0], matrix[1], matrix[2], (16 << 8) + 128, 8, frame->width);
- break;
- case 1:
- orc_matrix3_000_u8 (dest, src1, src2, src3,
- matrix[4], matrix[5], matrix[6], (128 << 8) + 128, 8, frame->width);
- break;
- case 2:
- orc_matrix3_000_u8 (dest, src1, src2, src3,
- matrix[8], matrix[9], matrix[10], (128 << 8) + 128, 8, frame->width);
- break;
- default:
- break;
- }
-
-}
-
-
-static const int cog_ycbcr_to_rgb_matrix_6bit_sdtv[] = {
- 75, 0, 102, -14267,
- 75, -25, -52, 8677,
- 75, 129, 0, -17717,
-};
-
-static const int cog_ycbcr_to_rgb_matrix_8bit_sdtv[] = {
- 42, 0, 153, -57068,
- 42, -100, -208, 34707,
- 42, 4, 0, -70870,
-};
-
-static const int cog_ycbcr_to_rgb_matrix_6bit_hdtv[] = {
- 75, 0, 115, -15878,
- 75, -14, -34, 4920,
- 75, 135, 0, -18497,
-};
-
-static const int cog_ycbcr_to_rgb_matrix_8bit_hdtv[] = {
- 42, 0, 203, -63514,
- 42, -55, -136, 19681,
- 42, 29, 0, -73988,
-};
-
-static void
-color_matrix_YCbCr_to_RGB_6bit (CogFrame * frame, void *_dest, int component,
- int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- uint8_t *src3;
- int *matrix = frame->virt_priv2;
-
- src1 = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src2 = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src3 = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- switch (component) {
- case 0:
- orc_matrix2_u8 (dest, src1, src3, matrix[0], matrix[2], matrix[3] + 32,
- frame->width);
- break;
- case 1:
- orc_matrix3_u8 (dest, src1, src2, src3, matrix[4], matrix[5], matrix[6],
- matrix[7] + 32, frame->width);
- break;
- case 2:
- orc_matrix2_u8 (dest, src1, src2,
- matrix[8], matrix[9], matrix[11] + 32, frame->width);
- break;
- default:
- break;
- }
-}
-
-static void
-color_matrix_YCbCr_to_RGB_8bit (CogFrame * frame, void *_dest, int component,
- int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- uint8_t *src3;
- int *matrix = frame->virt_priv2;
-
- src1 = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src2 = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src3 = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- switch (component) {
- case 0:
- orc_matrix2_11_u8 (dest, src1, src3, matrix[0], matrix[2], frame->width);
- break;
- case 1:
- orc_matrix3_100_u8 (dest, src1, src2, src3,
- matrix[4], matrix[5], matrix[6], frame->width);
- break;
- case 2:
- orc_matrix2_12_u8 (dest, src1, src2, matrix[8], matrix[9], frame->width);
- break;
- default:
- break;
- }
-}
-
-CogFrame *
-cog_virt_frame_new_color_matrix_YCbCr_to_RGB (CogFrame * vf,
- CogColorMatrix color_matrix, int bits)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_U8_444,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- if (bits <= 6) {
- virt_frame->render_line = color_matrix_YCbCr_to_RGB_6bit;
- if (color_matrix == COG_COLOR_MATRIX_HDTV) {
- virt_frame->virt_priv2 = (void *) cog_ycbcr_to_rgb_matrix_6bit_hdtv;
- } else {
- virt_frame->virt_priv2 = (void *) cog_ycbcr_to_rgb_matrix_6bit_sdtv;
- }
- } else {
- virt_frame->render_line = color_matrix_YCbCr_to_RGB_8bit;
- if (color_matrix == COG_COLOR_MATRIX_HDTV) {
- virt_frame->virt_priv2 = (void *) cog_ycbcr_to_rgb_matrix_8bit_hdtv;
- } else {
- virt_frame->virt_priv2 = (void *) cog_ycbcr_to_rgb_matrix_8bit_sdtv;
- }
- }
-
- return virt_frame;
-}
-
-CogFrame *
-cog_virt_frame_new_color_matrix_RGB_to_YCbCr (CogFrame * vf,
- CogColorMatrix color_matrix, int coefficient_bits)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_U8_444,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = color_matrix_RGB_to_YCbCr;
- if (color_matrix == COG_COLOR_MATRIX_HDTV) {
- virt_frame->virt_priv2 = (void *) cog_rgb_to_ycbcr_matrix_8bit_hdtv;
- } else {
- virt_frame->virt_priv2 = (void *) cog_rgb_to_ycbcr_matrix_8bit_sdtv;
- }
-
- return virt_frame;
-}
-
-static const int cog_ycbcr_sdtv_to_ycbcr_hdtv_matrix_8bit[] = {
- 256, -30, -53, 10600,
- 0, 261, 29, -4367,
- 0, 19, 262, -3289,
-};
-
-static const int cog_ycbcr_hdtv_to_ycbcr_sdtv_matrix_8bit[] = {
- 256, 25, 49, -9536,
- 0, 253, -28, 3958,
- 0, -19, 252, 2918,
-};
-
-
-static void
-color_matrix_YCbCr_to_YCbCr (CogFrame * frame, void *_dest, int component,
- int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- uint8_t *src3;
- int *matrix = frame->virt_priv2;
-
- src1 = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src2 = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src3 = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- switch (component) {
- case 0:
- orc_matrix3_100_offset_u8 (dest, src1, src2, src3,
- matrix[0] - 256, matrix[1], matrix[2], matrix[3], 8, frame->width);
- break;
- case 1:
- orc_matrix3_000_u8 (dest, src1, src2, src3,
- matrix[4], matrix[5], matrix[6], matrix[7], 8, frame->width);
- break;
- case 2:
- orc_matrix3_000_u8 (dest, src1, src2, src3,
- matrix[8], matrix[9], matrix[10], matrix[11], 8, frame->width);
- break;
- default:
- break;
- }
-
-}
-
-CogFrame *
-cog_virt_frame_new_color_matrix_YCbCr_to_YCbCr (CogFrame * vf,
- CogColorMatrix in_color_matrix, CogColorMatrix out_color_matrix, int bits)
-{
- CogFrame *virt_frame;
-
- if (in_color_matrix == out_color_matrix)
- return vf;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_U8_444,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = color_matrix_YCbCr_to_YCbCr;
- if (in_color_matrix == COG_COLOR_MATRIX_HDTV) {
- virt_frame->virt_priv2 = (void *) cog_ycbcr_hdtv_to_ycbcr_sdtv_matrix_8bit;
- } else {
- virt_frame->virt_priv2 = (void *) cog_ycbcr_sdtv_to_ycbcr_hdtv_matrix_8bit;
- }
-
- return virt_frame;
-}
-
-
-static void
-convert_444_422 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int n_src;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- n_src = frame->virt_frame1->components[component].width;
-
- if (component == 0) {
- orc_memcpy (dest, src, frame->width);
- } else {
- cogorc_downsample_horiz_cosite_1tap (dest + 1,
- (uint16_t *) (src + 2), frame->components[component].width - 1);
-
- {
- int j;
- int x;
-
- j = 0;
- x = 1 * src[CLAMP (j * 2 - 1, 0, n_src - 1)];
- x += 2 * src[CLAMP (j * 2 + 0, 0, n_src - 1)];
- x += 1 * src[CLAMP (j * 2 + 1, 0, n_src - 1)];
- dest[j] = CLAMP ((x + 2) >> 2, 0, 255);
- }
- }
-}
-
-static void
-convert_422_420 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
-
- if (component == 0) {
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- orc_memcpy (dest, src, frame->components[component].width);
- } else {
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- int n_src;
-
- n_src = frame->virt_frame1->components[component].height;
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 0, 0, n_src - 1));
- src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 1, 0, n_src - 1));
-
- cogorc_downsample_vert_halfsite_2tap (dest, src1, src2,
- frame->components[component].width);
- }
-}
-
-static void
-convert_444_420_mpeg2 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
-
- if (component == 0) {
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- orc_memcpy (dest, src, frame->components[component].width);
- } else {
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- int n_src;
-
- n_src = frame->virt_frame1->components[component].height;
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 0, 0, n_src - 1));
- src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 1, 0, n_src - 1));
-
-#if 0
- cogorc_downsample_420_mpeg2 (dest + 1,
- (uint16_t *) src1, (uint16_t *) (src1 + 2),
- (uint16_t *) src2, (uint16_t *) (src2 + 2),
- frame->components[component].width - 1);
-#else
- {
- int j;
- int x;
-
- for (j = 1; j < frame->components[component].width; j++) {
- x = 1 * src1[j * 2 - 1];
- x += 2 * src1[j * 2 + 0];
- x += 1 * src1[j * 2 + 1];
- x += 1 * src2[j * 2 - 1];
- x += 2 * src2[j * 2 + 0];
- x += 1 * src2[j * 2 + 1];
- dest[j] = CLAMP ((x + 4) >> 3, 0, 255);
- }
- }
-#endif
- {
- int j;
- int x;
-
- j = 0;
- x = 1 * src1[CLAMP (j * 2 - 1, 0, n_src - 1)];
- x += 2 * src1[CLAMP (j * 2 + 0, 0, n_src - 1)];
- x += 1 * src1[CLAMP (j * 2 + 1, 0, n_src - 1)];
- x += 1 * src2[CLAMP (j * 2 - 1, 0, n_src - 1)];
- x += 2 * src2[CLAMP (j * 2 + 0, 0, n_src - 1)];
- x += 1 * src2[CLAMP (j * 2 + 1, 0, n_src - 1)];
- dest[j] = CLAMP ((x + 4) >> 3, 0, 255);
- }
- }
-}
-
-static void
-convert_444_420_jpeg (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
-
- if (component == 0) {
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- orc_memcpy (dest, src, frame->components[component].width);
- } else {
- uint8_t *dest = _dest;
- uint8_t *src1;
- uint8_t *src2;
- int n_src;
-
- n_src = frame->virt_frame1->components[component].height;
- src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 0, 0, n_src - 1));
- src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
- CLAMP (i * 2 + 1, 0, n_src - 1));
-
- cogorc_downsample_420_jpeg (dest,
- (uint16_t *) src1, (uint16_t *) src2,
- frame->components[component].width);
- }
-}
-
-/* up */
-
-static void
-convert_420_444_mpeg2 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int n_taps = frame->param1;
-
- if (component == 0) {
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
-
- orc_memcpy (dest, src, frame->width);
- } else {
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i / 2);
-
- switch (n_taps) {
- default:
- case 2:
- cogorc_upsample_horiz_cosite (dest, src, src + 1,
- frame->components[component].width / 2 - 1);
- break;
- }
- dest[frame->components[component].width - 2] =
- src[frame->components[component].width / 2 - 1];
- dest[frame->components[component].width - 1] =
- src[frame->components[component].width / 2 - 1];
- }
-}
-
-static void
-convert_420_444_jpeg (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int n_taps = frame->param1;
-
- if (component == 0) {
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
-
- orc_memcpy (dest, src, frame->width);
- } else {
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i / 2);
-
- switch (n_taps) {
- default:
- case 1:
- cogorc_upsample_horiz_cosite_1tap (dest, src,
- frame->components[component].width / 2 - 1);
- break;
- }
- dest[frame->components[component].width - 2] =
- src[frame->components[component].width / 2 - 1];
- dest[frame->components[component].width - 1] =
- src[frame->components[component].width / 2 - 1];
- }
-}
-
-static void
-convert_422_444 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int n_taps = frame->param1;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
-
- if (component == 0) {
- orc_memcpy (dest, src, frame->width);
- } else {
- switch (n_taps) {
- default:
- case 2:
- cogorc_upsample_horiz_cosite (dest, src, src + 1,
- frame->components[component].width / 2 - 1);
- break;
- }
- dest[frame->components[component].width - 2] =
- src[frame->components[component].width / 2 - 1];
- dest[frame->components[component].width - 1] =
- src[frame->components[component].width / 2 - 1];
- }
-}
-
-static void
-convert_420_422 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- int n_taps = frame->param1;
-
- if (component == 0) {
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- orc_memcpy (dest, src, frame->components[component].width);
- } else {
- switch (n_taps) {
- case 1:
- default:
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i >> 1);
- orc_memcpy (dest, src, frame->components[component].width);
- break;
- case 2:
- if ((i & 1) && i < frame->components[component].height - 1) {
- uint8_t *src2;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i >> 1);
- src2 = cog_virt_frame_get_line (frame->virt_frame1,
- component, (i >> 1) + 1);
- cogorc_upsample_vert_avgub (dest, src, src2,
- frame->components[component].width);
- } else {
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i >> 1);
- orc_memcpy (dest, src, frame->components[component].width);
- }
- break;
- }
- }
-}
-
-CogFrame *
-cog_virt_frame_new_subsample (CogFrame * vf, CogFrameFormat format,
- CogChromaSite chroma_site, int n_taps)
-{
- CogFrame *virt_frame;
- CogFrameRenderFunc render_line;
-
- if (vf->format == format) {
- return vf;
- }
- if (vf->format == COG_FRAME_FORMAT_U8_422 &&
- format == COG_FRAME_FORMAT_U8_420) {
- render_line = convert_422_420;
- } else if (vf->format == COG_FRAME_FORMAT_U8_444 &&
- format == COG_FRAME_FORMAT_U8_420) {
- if (chroma_site == COG_CHROMA_SITE_MPEG2) {
- render_line = convert_444_420_mpeg2;
- } else {
- render_line = convert_444_420_jpeg;
- }
- } else if (vf->format == COG_FRAME_FORMAT_U8_444 &&
- format == COG_FRAME_FORMAT_U8_422) {
- render_line = convert_444_422;
- } else if (vf->format == COG_FRAME_FORMAT_U8_420 &&
- format == COG_FRAME_FORMAT_U8_422) {
- render_line = convert_420_422;
- } else if (vf->format == COG_FRAME_FORMAT_U8_420 &&
- format == COG_FRAME_FORMAT_U8_444) {
- if (chroma_site == COG_CHROMA_SITE_MPEG2) {
- render_line = convert_420_444_mpeg2;
- } else {
- render_line = convert_420_444_jpeg;
- }
- } else if (vf->format == COG_FRAME_FORMAT_U8_422 &&
- format == COG_FRAME_FORMAT_U8_444) {
- render_line = convert_422_444;
- } else {
- GST_ERROR ("trying to subsample from %d to %d", vf->format, format);
- g_return_val_if_reached (NULL);
- }
- virt_frame = cog_frame_new_virtual (NULL, format, vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->param1 = n_taps;
- virt_frame->render_line = render_line;
-
- return virt_frame;
-}
-
-
-static void
-convert_u8_s16 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- int16_t *src;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- orc_addc_convert_u8_s16 (dest, src, frame->components[component].width);
-}
-
-CogFrame *
-cog_virt_frame_new_convert_u8 (CogFrame * vf)
-{
- CogFrame *virt_frame;
- CogFrameFormat format;
-
- format = (vf->format & 3) | COG_FRAME_FORMAT_U8_444;
-
- virt_frame = cog_frame_new_virtual (NULL, format, vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = convert_u8_s16;
-
- return virt_frame;
-}
-
-static void
-convert_s16_u8 (CogFrame * frame, void *_dest, int component, int i)
-{
- int16_t *dest = _dest;
- uint8_t *src;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
-
- orc_subc_convert_s16_u8 (dest, src, frame->components[component].width);
-}
-
-CogFrame *
-cog_virt_frame_new_convert_s16 (CogFrame * vf)
-{
- CogFrame *virt_frame;
- CogFrameFormat format;
-
- format = (vf->format & 3) | COG_FRAME_FORMAT_S16_444;
-
- virt_frame = cog_frame_new_virtual (NULL, format, vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = convert_s16_u8;
-
- return virt_frame;
-}
-
-static void
-crop_u8 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- orc_memcpy (dest, src, frame->components[component].width);
-}
-
-static void
-crop_s16 (CogFrame * frame, void *_dest, int component, int i)
-{
- int16_t *dest = _dest;
- int16_t *src;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
- orc_memcpy (dest, src, frame->components[component].width * sizeof (int16_t));
-}
-
-CogFrame *
-cog_virt_frame_new_crop (CogFrame * vf, int width, int height)
-{
- CogFrame *virt_frame;
-
- if (width == vf->width && height == vf->height)
- return vf;
-
- g_return_val_if_fail (width <= vf->width, NULL);
- g_return_val_if_fail (height <= vf->height, NULL);
-
- virt_frame = cog_frame_new_virtual (NULL, vf->format, width, height);
- virt_frame->virt_frame1 = vf;
- switch (COG_FRAME_FORMAT_DEPTH (vf->format)) {
- case COG_FRAME_FORMAT_DEPTH_U8:
- virt_frame->render_line = crop_u8;
- break;
- case COG_FRAME_FORMAT_DEPTH_S16:
- virt_frame->render_line = crop_s16;
- break;
- default:
- g_return_val_if_reached (NULL);
- break;
- }
-
- return virt_frame;
-}
-
-static void
-edge_extend_u8 (CogFrame * frame, void *_dest, int component, int i)
-{
- uint8_t *dest = _dest;
- uint8_t *src;
- CogFrame *srcframe = frame->virt_frame1;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component,
- MIN (i, srcframe->components[component].height - 1));
- orc_memcpy (dest, src, srcframe->components[component].width);
- orc_splat_u8_ns (dest + srcframe->components[component].width,
- dest[srcframe->components[component].width - 1],
- frame->components[component].width -
- srcframe->components[component].width);
-}
-
-static void
-edge_extend_s16 (CogFrame * frame, void *_dest, int component, int i)
-{
- int16_t *dest = _dest;
- int16_t *src;
- CogFrame *srcframe = frame->virt_frame1;
-
- src = cog_virt_frame_get_line (frame->virt_frame1, component,
- MIN (i, srcframe->components[component].height - 1));
- orc_memcpy (dest, src,
- srcframe->components[component].width * sizeof (int16_t));
- orc_splat_s16_ns (dest + srcframe->components[component].width,
- dest[srcframe->components[component].width - 1],
- frame->components[component].width -
- srcframe->components[component].width);
-}
-
-CogFrame *
-cog_virt_frame_new_edgeextend (CogFrame * vf, int width, int height)
-{
- CogFrame *virt_frame;
-
- if (width == vf->width && height == vf->height)
- return vf;
-
- g_return_val_if_fail (width >= vf->width, NULL);
- g_return_val_if_fail (height >= vf->height, NULL);
-
- virt_frame = cog_frame_new_virtual (NULL, vf->format, width, height);
- virt_frame->virt_frame1 = vf;
- switch (COG_FRAME_FORMAT_DEPTH (vf->format)) {
- case COG_FRAME_FORMAT_DEPTH_U8:
- virt_frame->render_line = edge_extend_u8;
- break;
- case COG_FRAME_FORMAT_DEPTH_S16:
- virt_frame->render_line = edge_extend_s16;
- break;
- default:
- g_return_val_if_reached (NULL);
- break;
- }
-
- return virt_frame;
-}
-
-
-
-static void
-pack_RGBx (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_r;
- uint8_t *src_g;
- uint8_t *src_b;
-
- src_r = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_g = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_b = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_123x (dest, src_r, src_g, src_b, 0xff, frame->width);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_RGBx (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_RGBx,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_RGBx;
-
- return virt_frame;
-}
-
-static void
-pack_xRGB (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_r;
- uint8_t *src_g;
- uint8_t *src_b;
-
- src_r = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_g = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_b = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_x123 (dest, src_r, src_g, src_b, 0xff, frame->width);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_xRGB (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_xRGB,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_xRGB;
-
- return virt_frame;
-}
-
-static void
-pack_BGRx (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_r;
- uint8_t *src_g;
- uint8_t *src_b;
-
- src_r = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_g = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_b = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_123x (dest, src_b, src_g, src_r, 0xff, frame->width);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_BGRx (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_BGRx,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_BGRx;
-
- return virt_frame;
-}
-
-static void
-pack_xBGR (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_r;
- uint8_t *src_g;
- uint8_t *src_b;
-
- src_r = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_g = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_b = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_x123 (dest, src_b, src_g, src_r, 0xff, frame->width);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_xBGR (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_xBGR,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_xBGR;
-
- return virt_frame;
-}
-
-static void
-pack_RGBA (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_r;
- uint8_t *src_g;
- uint8_t *src_b;
-
- src_r = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_g = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_b = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_123x (dest, src_r, src_g, src_b, 0xff, frame->width);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_RGBA (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_RGBA,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_RGBA;
-
- return virt_frame;
-}
-
-static void
-pack_ARGB (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_r;
- uint8_t *src_g;
- uint8_t *src_b;
-
- src_r = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_g = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_b = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_x123 (dest, src_r, src_g, src_b, 0xff, frame->width);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_ARGB (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_ARGB,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_ARGB;
-
- return virt_frame;
-}
-
-static void
-pack_BGRA (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_r;
- uint8_t *src_g;
- uint8_t *src_b;
-
- src_r = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_g = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_b = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_123x (dest, src_b, src_g, src_r, 0xff, frame->width);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_BGRA (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_BGRA,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_BGRA;
-
- return virt_frame;
-}
-
-static void
-pack_ABGR (CogFrame * frame, void *_dest, int component, int i)
-{
- uint32_t *dest = _dest;
- uint8_t *src_r;
- uint8_t *src_g;
- uint8_t *src_b;
-
- src_r = cog_virt_frame_get_line (frame->virt_frame1, 0, i);
- src_g = cog_virt_frame_get_line (frame->virt_frame1, 1, i);
- src_b = cog_virt_frame_get_line (frame->virt_frame1, 2, i);
-
- orc_pack_x123 (dest, src_b, src_g, src_r, 0xff, frame->width);
-}
-
-CogFrame *
-cog_virt_frame_new_pack_ABGR (CogFrame * vf)
-{
- CogFrame *virt_frame;
-
- virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_ABGR,
- vf->width, vf->height);
- virt_frame->virt_frame1 = vf;
- virt_frame->render_line = pack_ABGR;
-
- return virt_frame;
-}
diff --git a/ext/cog/cogvirtframe.h b/ext/cog/cogvirtframe.h
deleted file mode 100644
index afd5736b8..000000000
--- a/ext/cog/cogvirtframe.h
+++ /dev/null
@@ -1,55 +0,0 @@
-
-#ifndef __COG_VIRT_FRAME_H__
-#define __COG_VIRT_FRAME_H__
-
-#include <cog/cogutils.h>
-#include <cog/cogframe.h>
-
-COG_BEGIN_DECLS
-
-CogFrame *cog_frame_new_virtual (CogMemoryDomain *domain,
- CogFrameFormat format, int width, int height);
-
-void *cog_virt_frame_get_line (CogFrame *frame, int component, int i);
-void cog_virt_frame_render_line (CogFrame *frame, void *dest,
- int component, int i);
-
-void cog_virt_frame_render (CogFrame *frame, CogFrame *dest);
-
-CogFrame *cog_virt_frame_new_horiz_downsample (CogFrame *vf, int n_taps);
-CogFrame *cog_virt_frame_new_vert_downsample (CogFrame *vf, int n_taps);
-CogFrame *cog_virt_frame_new_vert_resample (CogFrame *vf, int height, int n_taps);
-CogFrame *cog_virt_frame_new_horiz_resample (CogFrame *vf, int width, int n_taps);
-CogFrame *cog_virt_frame_new_unpack (CogFrame *vf);
-CogFrame *cog_virt_frame_new_pack_YUY2 (CogFrame *vf);
-CogFrame *cog_virt_frame_new_pack_UYVY (CogFrame *vf);
-CogFrame *cog_virt_frame_new_pack_AYUV (CogFrame *vf);
-CogFrame *cog_virt_frame_new_pack_v216 (CogFrame *vf);
-CogFrame *cog_virt_frame_new_pack_v210 (CogFrame *vf);
-CogFrame *cog_virt_frame_new_pack_RGB (CogFrame *vf);
-CogFrame *cog_virt_frame_new_color_matrix_YCbCr_to_RGB (CogFrame *vf, CogColorMatrix color_matrix, int coefficient_bits);
-CogFrame * cog_virt_frame_new_color_matrix_RGB_to_YCbCr (CogFrame * vf, CogColorMatrix color_matrix, int coefficient_bits);
-CogFrame * cog_virt_frame_new_color_matrix_YCbCr_to_YCbCr (CogFrame * vf,
- CogColorMatrix in_color_matrix, CogColorMatrix out_color_matrix,
- int bits);
-CogFrame *cog_virt_frame_new_subsample (CogFrame *vf, CogFrameFormat format,
- CogChromaSite site, int n_taps);
-
-CogFrame * cog_virt_frame_new_convert_u8 (CogFrame *vf);
-CogFrame * cog_virt_frame_new_convert_s16 (CogFrame *vf);
-CogFrame * cog_virt_frame_new_crop (CogFrame *vf, int width, int height);
-CogFrame * cog_virt_frame_new_edgeextend (CogFrame *vf, int width, int height);
-
-CogFrame * cog_virt_frame_new_pack_RGBx (CogFrame *vf);
-CogFrame * cog_virt_frame_new_pack_xRGB (CogFrame *vf);
-CogFrame * cog_virt_frame_new_pack_BGRx (CogFrame *vf);
-CogFrame * cog_virt_frame_new_pack_xBGR (CogFrame *vf);
-CogFrame * cog_virt_frame_new_pack_RGBA (CogFrame *vf);
-CogFrame * cog_virt_frame_new_pack_ARGB (CogFrame *vf);
-CogFrame * cog_virt_frame_new_pack_BGRA (CogFrame *vf);
-CogFrame * cog_virt_frame_new_pack_ABGR (CogFrame *vf);
-
-COG_END_DECLS
-
-#endif
-
diff --git a/ext/cog/generate_tables.c b/ext/cog/generate_tables.c
deleted file mode 100644
index 033f23c39..000000000
--- a/ext/cog/generate_tables.c
+++ /dev/null
@@ -1,239 +0,0 @@
-
-#include "config.h"
-
-#include <glib.h>
-#include <gst/math-compat.h>
-#include <math.h>
-
-#include "gstcms.h"
-
-#define SCALE 256
-
-static void
-get_taps (double *taps, double x)
-{
- taps[3] = x * x * (x - 1);
- taps[2] = x * (-x * x + x + 1);
- x = 1 - x;
- taps[1] = x * (-x * x + x + 1);
- taps[0] = x * x * (x - 1);
-}
-
-int
-main (int argc, char *argv[])
-{
- int i;
-
- g_print ("/* This file is autogenerated. Do not edit.*/\n");
- g_print ("#include <glib.h>\n");
- g_print ("gint8 cog_resample_table_4tap[256][4] = {\n");
- for (i = 0; i < 256; i++) {
- double x = i / 256.0;
- double taps[4];
- int t[4];
- int sum;
-
- get_taps (taps, x);
- taps[0] *= SCALE;
- taps[1] *= SCALE;
- taps[2] *= SCALE;
- taps[3] *= SCALE;
-
- t[0] = floor (taps[0]);
- t[1] = floor (taps[1]);
- t[2] = floor (taps[2]);
- t[3] = floor (taps[3]);
- sum = t[0] + t[1] + t[2] + t[3];
-
- for (; sum < SCALE; sum++) {
- int i;
- double max = 0;
- int max_i = -1;
- for (i = 0; i < 4; i++) {
- if (max_i == -1 || (t[i] < taps[i] && (taps[i] - t[i]) > max)) {
- max_i = i;
- max = taps[i] - t[i];
- }
- }
- t[max_i]++;
- }
- sum = t[0] + t[1] + t[2] + t[3];
-
- g_print (" { %d, %d, %d, %d }, /* %d %d */\n",
- t[0], t[1], t[2], t[3], t[2] + t[0], t[1] + t[3]);
-#if 0
- g_print ("/* %.3f %.3f %.3f %.3f %d */\n",
- taps[0] - t[0], taps[1] - t[1], taps[2] - t[2], taps[3] - t[3], sum);
-#endif
- }
- g_print ("};\n");
- g_print ("\n");
-
-
- {
- int cm, bits;
-
- for (cm = 0; cm < 2; cm++) {
- for (bits = 6; bits <= 8; bits += 2) {
-
- ColorMatrix matrix;
-
- /*
- * At this point, everything is in YCbCr
- * All components are in the range [0,255]
- */
- color_matrix_set_identity (&matrix);
-
- /* offset required to get input video black to (0.,0.,0.) */
- /* we don't do this because the code does it for us */
- color_matrix_offset_components (&matrix, -16, -128, -128);
-
- color_matrix_scale_components (&matrix, (1 / 219.0), (1 / 224.0),
- (1 / 224.0));
-
- /* colour matrix, YCbCr -> RGB */
- /* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */
- if (cm) {
- color_matrix_YCbCr_to_RGB (&matrix, 0.2126, 0.0722); /* HD */
- } else {
- color_matrix_YCbCr_to_RGB (&matrix, 0.2990, 0.1140); /* SD */
- }
-
- /*
- * We are now in RGB space
- */
-
- /* scale to output range. */
- color_matrix_scale_components (&matrix, 255.0, 255.0, 255.0);
-
- /* because we're doing 8-bit matrix coefficients */
- color_matrix_scale_components (&matrix, 1 << bits, 1 << bits,
- 1 << bits);
-
- g_print ("static const int cog_ycbcr_to_rgb_matrix_%dbit_%s[] = {\n",
- bits, cm ? "hdtv" : "sdtv");
- g_print (" %d, %d, %d, %d,\n",
- (int) rint (matrix.m[0][0]),
- (int) rint (matrix.m[0][1]),
- (int) rint (matrix.m[0][2]), (int) rint (matrix.m[0][3]));
- g_print (" %d, %d, %d, %d,\n",
- (int) rint (matrix.m[1][0]),
- (int) rint (matrix.m[1][1]),
- (int) rint (matrix.m[1][2]), (int) rint (matrix.m[1][3]));
- g_print (" %d, %d, %d, %d,\n",
- (int) rint (matrix.m[2][0]),
- (int) rint (matrix.m[2][1]),
- (int) rint (matrix.m[2][2]), (int) rint (matrix.m[2][3]));
- g_print ("};\n");
- }
- }
- }
-
- {
- int cm, bits;
-
- for (cm = 0; cm < 2; cm++) {
- for (bits = 8; bits <= 8; bits += 1) {
-
- ColorMatrix matrix;
-
- color_matrix_set_identity (&matrix);
-
- color_matrix_scale_components (&matrix, (1 / 255.0), (1 / 255.0),
- (1 / 255.0));
-
- /* colour matrix, RGB -> YCbCr */
- if (cm) {
- color_matrix_RGB_to_YCbCr (&matrix, 0.2126, 0.0722); /* HD */
- } else {
- color_matrix_RGB_to_YCbCr (&matrix, 0.2990, 0.1140); /* SD */
- }
-
- /*
- * We are now in YCbCr space
- */
-
- color_matrix_scale_components (&matrix, 219.0, 224.0, 224.0);
-
- color_matrix_offset_components (&matrix, 16, 128, 128);
-
- /* because we're doing 8-bit matrix coefficients */
- color_matrix_scale_components (&matrix, 1 << bits, 1 << bits,
- 1 << bits);
-
- g_print ("static const int cog_rgb_to_ycbcr_matrix_%dbit_%s[] = {\n",
- bits, cm ? "hdtv" : "sdtv");
- g_print (" %d, %d, %d, %d,\n",
- (int) rint (matrix.m[0][0]),
- (int) rint (matrix.m[0][1]),
- (int) rint (matrix.m[0][2]), (int) rint (matrix.m[0][3]));
- g_print (" %d, %d, %d, %d,\n",
- (int) rint (matrix.m[1][0]),
- (int) rint (matrix.m[1][1]),
- (int) rint (matrix.m[1][2]), (int) rint (matrix.m[1][3]));
- g_print (" %d, %d, %d, %d,\n",
- (int) rint (matrix.m[2][0]),
- (int) rint (matrix.m[2][1]),
- (int) rint (matrix.m[2][2]), (int) rint (matrix.m[2][3]));
- g_print ("};\n");
- }
- }
- }
-
- {
- int cm, bits;
-
- for (cm = 0; cm < 2; cm++) {
- for (bits = 8; bits <= 8; bits += 1) {
-
- ColorMatrix matrix;
-
- color_matrix_set_identity (&matrix);
-
- /* offset required to get input video black to (0.,0.,0.) */
- /* we don't do this because the code does it for us */
- color_matrix_offset_components (&matrix, -16, -128, -128);
-
- color_matrix_scale_components (&matrix, (1 / 219.0), (1 / 224.0),
- (1 / 224.0));
-
- /* colour matrix, RGB -> YCbCr */
- if (cm) {
- color_matrix_YCbCr_to_RGB (&matrix, 0.2126, 0.0722); /* HD */
- color_matrix_RGB_to_YCbCr (&matrix, 0.2990, 0.1140); /* SD */
- } else {
- color_matrix_YCbCr_to_RGB (&matrix, 0.2990, 0.1140); /* SD */
- color_matrix_RGB_to_YCbCr (&matrix, 0.2126, 0.0722); /* HD */
- }
-
- /*
- * We are now in YCbCr space
- */
-
- color_matrix_scale_components (&matrix, 219.0, 224.0, 224.0);
-
- color_matrix_offset_components (&matrix, 16, 128, 128);
-
- /* because we're doing 8-bit matrix coefficients */
- color_matrix_scale_components (&matrix, 1 << bits, 1 << bits,
- 1 << bits);
-
- g_print
- ("static const int cog_ycbcr_%s_to_ycbcr_%s_matrix_%dbit[] = {\n",
- cm ? "hdtv" : "sdtv", cm ? "sdtv" : "hdtv", bits);
- g_print (" %d, %d, %d, %d,\n", (int) rint (matrix.m[0][0]),
- (int) rint (matrix.m[0][1]), (int) rint (matrix.m[0][2]),
- (int) rint (matrix.m[0][3]));
- g_print (" %d, %d, %d, %d,\n", (int) rint (matrix.m[1][0]),
- (int) rint (matrix.m[1][1]), (int) rint (matrix.m[1][2]),
- (int) rint (matrix.m[1][3]));
- g_print (" %d, %d, %d, %d,\n", (int) rint (matrix.m[2][0]),
- (int) rint (matrix.m[2][1]), (int) rint (matrix.m[2][2]),
- (int) rint (matrix.m[2][3]));
- g_print ("};\n");
- }
- }
- }
-
- return 0;
-}
diff --git a/ext/cog/gstcms.c b/ext/cog/gstcms.c
deleted file mode 100644
index c8d0ad17e..000000000
--- a/ext/cog/gstcms.c
+++ /dev/null
@@ -1,575 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 David Schleef <ds@entropywave.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/math-compat.h>
-#include "gstcms.h"
-
-#include "cogutils.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-
-/* our simple CMS */
-
-void
-color_xyY_to_XYZ (Color * c)
-{
- if (c->v[1] == 0) {
- c->v[0] = 0;
- c->v[1] = 0;
- c->v[2] = 0;
- } else {
- double X, Y, Z;
- X = c->v[0] * c->v[2] / c->v[1];
- Y = c->v[2];
- Z = (1.0 - c->v[0] - c->v[1]) * c->v[2] / c->v[1];
- c->v[0] = X;
- c->v[1] = Y;
- c->v[2] = Z;
- }
-}
-
-void
-color_XYZ_to_xyY (Color * c)
-{
- double d;
- d = c->v[0] + c->v[1] + c->v[2];
- if (d == 0) {
- c->v[0] = 0.3128;
- c->v[1] = 0.3290;
- c->v[2] = 0;
- } else {
- double x, y, Y;
- x = c->v[0] / d;
- y = c->v[1] / d;
- Y = c->v[1];
- c->v[0] = x;
- c->v[1] = y;
- c->v[2] = Y;
- }
-}
-
-void
-color_set (Color * c, double x, double y, double z)
-{
- c->v[0] = x;
- c->v[1] = y;
- c->v[2] = z;
-}
-
-void
-color_matrix_set_identity (ColorMatrix * m)
-{
- int i, j;
-
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- m->m[i][j] = (i == j);
- }
- }
-}
-
-/* Prettyprint a 4x4 matrix @m@ */
-void
-color_matrix_dump (ColorMatrix * m)
-{
- int i, j;
-
- printf ("[\n");
- for (i = 0; i < 4; i++) {
- printf (" ");
- for (j = 0; j < 4; j++) {
- printf (" %8.5g", m->m[i][j]);
- }
- printf ("\n");
- }
- printf ("]\n");
-}
-
-/* Perform 4x4 matrix multiplication:
- * - @dst@ = @a@ * @b@
- * - @dst@ may be a pointer to @a@ andor @b@
- */
-void
-color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b)
-{
- ColorMatrix tmp;
- int i, j, k;
-
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- double x = 0;
- for (k = 0; k < 4; k++) {
- x += a->m[i][k] * b->m[k][j];
- }
- tmp.m[i][j] = x;
- }
- }
-
- memcpy (dst, &tmp, sizeof (ColorMatrix));
-}
-
-void
-color_matrix_apply (ColorMatrix * m, Color * dest, Color * src)
-{
- int i;
- Color tmp;
-
- for (i = 0; i < 3; i++) {
- double x = 0;
- x += m->m[i][0] * src->v[0];
- x += m->m[i][1] * src->v[1];
- x += m->m[i][2] * src->v[2];
- x += m->m[i][3];
- tmp.v[i] = x;
- }
- memcpy (dest, &tmp, sizeof (tmp));
-}
-
-void
-color_matrix_offset_components (ColorMatrix * m, double a1, double a2,
- double a3)
-{
- ColorMatrix a;
-
- color_matrix_set_identity (&a);
- a.m[0][3] = a1;
- a.m[1][3] = a2;
- a.m[2][3] = a3;
- color_matrix_multiply (m, &a, m);
-}
-
-void
-color_matrix_scale_components (ColorMatrix * m, double a1, double a2, double a3)
-{
- ColorMatrix a;
-
- color_matrix_set_identity (&a);
- a.m[0][0] = a1;
- a.m[1][1] = a2;
- a.m[2][2] = a3;
- color_matrix_multiply (m, &a, m);
-}
-
-void
-color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb)
-{
- double Kg = 1.0 - Kr - Kb;
- ColorMatrix k = {
- {
- {1., 0., 2 * (1 - Kr), 0.},
- {1., -2 * Kb * (1 - Kb) / Kg, -2 * Kr * (1 - Kr) / Kg, 0.},
- {1., 2 * (1 - Kb), 0., 0.},
- {0., 0., 0., 1.},
- }
- };
-
- color_matrix_multiply (m, &k, m);
-}
-
-void
-color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb)
-{
- double Kg = 1.0 - Kr - Kb;
- ColorMatrix k;
- double x;
-
- k.m[0][0] = Kr;
- k.m[0][1] = Kg;
- k.m[0][2] = Kb;
- k.m[0][3] = 0;
-
- x = 1 / (2 * (1 - Kb));
- k.m[1][0] = -x * Kr;
- k.m[1][1] = -x * Kg;
- k.m[1][2] = x * (1 - Kb);
- k.m[1][3] = 0;
-
- x = 1 / (2 * (1 - Kr));
- k.m[2][0] = x * (1 - Kr);
- k.m[2][1] = -x * Kg;
- k.m[2][2] = -x * Kb;
- k.m[2][3] = 0;
-
- k.m[3][0] = 0;
- k.m[3][1] = 0;
- k.m[3][2] = 0;
- k.m[3][3] = 1;
-
- color_matrix_multiply (m, &k, m);
-}
-
-void
-color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst)
-{
- /*
- * At this point, everything is in YCbCr
- * All components are in the range [0,255]
- */
- color_matrix_set_identity (dst);
-
- /* offset required to get input video black to (0.,0.,0.) */
- color_matrix_offset_components (dst, -16, -128, -128);
-
- /* scale required to get input video black to (0.,0.,0.) */
- color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0), (1 / 224.0));
-
- /* colour matrix, YCbCr -> RGB */
- /* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */
- color_matrix_YCbCr_to_RGB (dst, 0.2990, 0.1140); /* SD */
-
- /*
- * We are now in RGB space
- */
-
-#if 0
- /* scale to output range. */
- color_matrix_scale_components (dst, 255.0, 255.0, 255.0);
-#endif
-}
-
-void
-color_matrix_build_bt709_to_bt601 (ColorMatrix * dst)
-{
- color_matrix_set_identity (dst);
-
- /* offset required to get input video black to (0.,0.,0.) */
- color_matrix_offset_components (dst, -16, -128, -128);
-
- /* scale required to get input video black to (0.,0.,0.) */
- color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0), (1 / 224.0));
-
- /* colour matrix, YCbCr -> RGB */
- /* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */
- color_matrix_YCbCr_to_RGB (dst, 0.2126, 0.0722); /* HD */
-
- color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140); /* SD */
-
- color_matrix_scale_components (dst, 219.0, 224.0, 224.0);
-
- color_matrix_offset_components (dst, 16, 128, 128);
-}
-
-void
-color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst)
-{
- color_matrix_set_identity (dst);
-
- color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140); /* SD */
-
- color_matrix_scale_components (dst, 219.0, 224.0, 224.0);
-
- color_matrix_offset_components (dst, 16, 128, 128);
-
- {
- Color c;
- int i;
- for (i = 7; i >= 0; i--) {
- color_set (&c, (i & 2) ? 0.75 : 0.0, (i & 4) ? 0.75 : 0.0,
- (i & 1) ? 0.75 : 0.0);
- color_matrix_apply (dst, &c, &c);
- g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
- rint (c.v[2]));
- }
- color_set (&c, -0.075, -0.075, -0.075);
- color_matrix_apply (dst, &c, &c);
- g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
- rint (c.v[2]));
- color_set (&c, 0.075, 0.075, 0.075);
- color_matrix_apply (dst, &c, &c);
- g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
- rint (c.v[2]));
- }
-}
-
-void
-color_matrix_invert (ColorMatrix * m)
-{
- ColorMatrix tmp;
- int i, j;
- double det;
-
- color_matrix_set_identity (&tmp);
- for (j = 0; j < 3; j++) {
- for (i = 0; i < 3; i++) {
- tmp.m[j][i] =
- m->m[(i + 1) % 3][(j + 1) % 3] * m->m[(i + 2) % 3][(j + 2) % 3] -
- m->m[(i + 1) % 3][(j + 2) % 3] * m->m[(i + 2) % 3][(j + 1) % 3];
- }
- }
- det =
- tmp.m[0][0] * m->m[0][0] + tmp.m[0][1] * m->m[1][0] +
- tmp.m[0][2] * m->m[2][0];
- for (j = 0; j < 3; j++) {
- for (i = 0; i < 3; i++) {
- tmp.m[i][j] /= det;
- }
- }
- memcpy (m, &tmp, sizeof (tmp));
-}
-
-void
-color_matrix_copy (ColorMatrix * dest, ColorMatrix * src)
-{
- memcpy (dest, src, sizeof (ColorMatrix));
-}
-
-void
-color_matrix_transpose (ColorMatrix * m)
-{
- int i, j;
- ColorMatrix tmp;
-
- color_matrix_set_identity (&tmp);
- for (i = 0; i < 3; i++) {
- for (j = 0; j < 3; j++) {
- tmp.m[i][j] = m->m[j][i];
- }
- }
- memcpy (m, &tmp, sizeof (ColorMatrix));
-}
-
-void
-color_matrix_build_XYZ (ColorMatrix * dst,
- double rx, double ry,
- double gx, double gy, double bx, double by, double wx, double wy)
-{
- Color r, g, b, w, scale;
- ColorMatrix m;
-
- color_set (&r, rx, ry, 1.0);
- color_xyY_to_XYZ (&r);
- color_set (&g, gx, gy, 1.0);
- color_xyY_to_XYZ (&g);
- color_set (&b, bx, by, 1.0);
- color_xyY_to_XYZ (&b);
- color_set (&w, wx, wy, 1.0);
- color_xyY_to_XYZ (&w);
-
- color_matrix_set_identity (dst);
-
- dst->m[0][0] = r.v[0];
- dst->m[0][1] = r.v[1];
- dst->m[0][2] = r.v[2];
- dst->m[1][0] = g.v[0];
- dst->m[1][1] = g.v[1];
- dst->m[1][2] = g.v[2];
- dst->m[2][0] = b.v[0];
- dst->m[2][1] = b.v[1];
- dst->m[2][2] = b.v[2];
-
- color_matrix_dump (dst);
- color_matrix_copy (&m, dst);
- color_matrix_invert (&m);
- color_matrix_dump (&m);
-
- color_matrix_transpose (&m);
- color_matrix_apply (&m, &scale, &w);
- g_print ("%g %g %g\n", scale.v[0], scale.v[1], scale.v[2]);
-
- dst->m[0][0] = r.v[0] * scale.v[0];
- dst->m[0][1] = r.v[1] * scale.v[0];
- dst->m[0][2] = r.v[2] * scale.v[0];
- dst->m[1][0] = g.v[0] * scale.v[1];
- dst->m[1][1] = g.v[1] * scale.v[1];
- dst->m[1][2] = g.v[2] * scale.v[1];
- dst->m[2][0] = b.v[0] * scale.v[2];
- dst->m[2][1] = b.v[1] * scale.v[2];
- dst->m[2][2] = b.v[2] * scale.v[2];
-
- color_matrix_transpose (dst);
- color_matrix_dump (dst);
-
- color_set (&scale, 1, 1, 1);
- color_matrix_apply (dst, &scale, &scale);
- color_XYZ_to_xyY (&scale);
- g_print ("white %g %g %g\n", scale.v[0], scale.v[1], scale.v[2]);
-
-}
-
-void
-color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst)
-{
- /* SMPTE C primaries, SMPTE 170M-2004 */
- color_matrix_build_XYZ (dst,
- 0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290);
-#if 0
- /* NTSC 1953 primaries, SMPTE 170M-2004 */
- color_matrix_build_XYZ (dst,
- 0.67, 0.33, 0.21, 0.71, 0.14, 0.08, 0.3127, 0.3290);
-#endif
-}
-
-void
-color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst)
-{
- /* Rec. ITU-R BT.709-5 */
- color_matrix_build_XYZ (dst,
- 0.640, 0.330, 0.300, 0.600, 0.150, 0.060, 0.3127, 0.3290);
-}
-
-void
-color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst)
-{
- /* Dell monitor */
-#if 1
- color_matrix_build_XYZ (dst,
- 0.662, 0.329, 0.205, 0.683, 0.146, 0.077, 0.3135, 0.3290);
-#endif
-#if 0
- color_matrix_build_XYZ (dst,
- 0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290);
-#endif
- color_matrix_invert (dst);
-}
-
-void
-color_transfer_function_apply (Color * dest, Color * src)
-{
- int i;
-
- for (i = 0; i < 3; i++) {
- if (src->v[i] < 0.0812) {
- dest->v[i] = src->v[i] / 4.500;
- } else {
- dest->v[i] = pow (src->v[i] + 0.099, 1 / 0.4500);
- }
- }
-}
-
-void
-color_transfer_function_unapply (Color * dest, Color * src)
-{
- int i;
-
- for (i = 0; i < 3; i++) {
- if (src->v[i] < 0.0812 / 4.500) {
- dest->v[i] = src->v[i] * 4.500;
- } else {
- dest->v[i] = pow (src->v[i], 0.4500) - 0.099;
- }
- }
-}
-
-void
-color_gamut_clamp (Color * dest, Color * src)
-{
- dest->v[0] = CLAMP (src->v[0], 0.0, 1.0);
- dest->v[1] = CLAMP (src->v[1], 0.0, 1.0);
- dest->v[2] = CLAMP (src->v[2], 0.0, 1.0);
-}
-
-#if 0
-static guint8 *
-get_color_transform_table (void)
-{
- static guint8 *color_transform_table = NULL;
-
-#if 1
- if (!color_transform_table) {
- ColorMatrix bt601_to_rgb;
- ColorMatrix bt601_to_yuv;
- ColorMatrix bt601_rgb_to_XYZ;
- ColorMatrix dell_XYZ_to_rgb;
- guint8 *table_y;
- guint8 *table_u;
- guint8 *table_v;
- int y, u, v;
-
- color_matrix_build_yuv_to_rgb_601 (&bt601_to_rgb);
- color_matrix_build_rgb_to_yuv_601 (&bt601_to_yuv);
- color_matrix_build_rgb_to_XYZ_601 (&bt601_rgb_to_XYZ);
- color_matrix_build_XYZ_to_rgb_dell (&dell_XYZ_to_rgb);
-
- color_transform_table = g_malloc (0x1000000 * 3);
-
- table_y = COG_OFFSET (color_transform_table, 0 * 0x1000000);
- table_u = COG_OFFSET (color_transform_table, 1 * 0x1000000);
- table_v = COG_OFFSET (color_transform_table, 2 * 0x1000000);
-
- for (y = 0; y < 256; y++) {
- for (u = 0; u < 256; u++) {
- for (v = 0; v < 256; v++) {
- Color c;
-
- c.v[0] = y;
- c.v[1] = u;
- c.v[2] = v;
- color_matrix_apply (&bt601_to_rgb, &c, &c);
- color_gamut_clamp (&c, &c);
- color_transfer_function_apply (&c, &c);
- color_matrix_apply (&bt601_rgb_to_XYZ, &c, &c);
- color_matrix_apply (&dell_XYZ_to_rgb, &c, &c);
- color_transfer_function_unapply (&c, &c);
- color_gamut_clamp (&c, &c);
- color_matrix_apply (&bt601_to_yuv, &c, &c);
-
- table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]);
- table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]);
- table_v[(y << 16) | (u << 8) | (v)] = rint (c.v[2]);
- }
- }
- }
- }
-#endif
-#if 0
- if (!color_transform_table) {
- ColorMatrix bt709_to_bt601;
- guint8 *table_y;
- guint8 *table_u;
- guint8 *table_v;
- int y, u, v;
-
- color_matrix_build_bt709_to_bt601 (&bt709_to_bt601);
-
- color_transform_table = g_malloc (0x1000000 * 3);
-
- table_y = COG_OFFSET (color_transform_table, 0 * 0x1000000);
- table_u = COG_OFFSET (color_transform_table, 1 * 0x1000000);
- table_v = COG_OFFSET (color_transform_table, 2 * 0x1000000);
-
- for (y = 0; y < 256; y++) {
- for (u = 0; u < 256; u++) {
- for (v = 0; v < 256; v++) {
- Color c;
-
- c.v[0] = y;
- c.v[1] = u;
- c.v[2] = v;
- color_matrix_apply (&bt709_to_bt601, &c, &c);
-
- table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]);
- table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]);
- table_v[(y << 16) | (u << 8) | (v)] = rint (c.v[2]);
- }
- }
- }
- }
-#endif
-
- return color_transform_table;
-}
-#endif
diff --git a/ext/cog/gstcms.h b/ext/cog/gstcms.h
deleted file mode 100644
index f926a44af..000000000
--- a/ext/cog/gstcms.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 David Schleef <ds@entropywave.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_CMS_H_
-#define _GST_CMS_H_
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-typedef struct _Color Color;
-typedef struct _ColorMatrix ColorMatrix;
-
-struct _Color
-{
- double v[3];
-};
-
-struct _ColorMatrix
-{
- double m[4][4];
-};
-
-void color_xyY_to_XYZ (Color * c);
-void color_XYZ_to_xyY (Color * c);
-void color_set (Color * c, double x, double y, double z);
-void color_matrix_set_identity (ColorMatrix * m);
-void color_matrix_dump (ColorMatrix * m);
-void color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b);
-void color_matrix_apply (ColorMatrix * m, Color * dest, Color * src);
-void color_matrix_offset_components (ColorMatrix * m, double a1, double a2,
- double a3);
-void color_matrix_scale_components (ColorMatrix * m, double a1, double a2, double a3);
-void color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb);
-void color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb);
-void color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst);
-void color_matrix_build_bt709_to_bt601 (ColorMatrix * dst);
-void color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst);
-void color_matrix_invert (ColorMatrix * m);
-void color_matrix_copy (ColorMatrix * dest, ColorMatrix * src);
-void color_matrix_transpose (ColorMatrix * m);
-void color_matrix_build_XYZ (ColorMatrix * dst,
- double rx, double ry,
- double gx, double gy, double bx, double by, double wx, double wy);
-void color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst);
-void color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst);
-void color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst);
-void color_transfer_function_apply (Color * dest, Color * src);
-void color_transfer_function_unapply (Color * dest, Color * src);
-void color_gamut_clamp (Color * dest, Color * src);
-
-G_END_DECLS
-
-#endif
-
diff --git a/ext/cog/gstcog.c b/ext/cog/gstcog.c
deleted file mode 100644
index 232952743..000000000
--- a/ext/cog/gstcog.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <gst/gst.h>
-#ifdef HAVE_ORC
-#include <orc/orc.h>
-#endif
-
-GType gst_deblock_get_type (void);
-GType gst_cogdownsample_get_type (void);
-GType gst_cogcolorspace_get_type (void);
-GType gst_cog_scale_get_type (void);
-GType gst_colorconvert_get_type (void);
-GType gst_logoinsert_get_type (void);
-GType gst_mse_get_type (void);
-
-GST_DEBUG_CATEGORY (cog_debug);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-#ifdef HAVE_ORC
- orc_init ();
-#endif
-
- GST_DEBUG_CATEGORY_INIT (cog_debug, "cog", 0, "Cog");
-
- gst_element_register (plugin, "cogdownsample", GST_RANK_NONE,
- gst_cogdownsample_get_type ());
- gst_element_register (plugin, "cogcolorspace", GST_RANK_NONE,
- gst_cogcolorspace_get_type ());
- gst_element_register (plugin, "cogscale", GST_RANK_NONE,
- gst_cog_scale_get_type ());
- gst_element_register (plugin, "cogcolorconvert", GST_RANK_NONE,
- gst_colorconvert_get_type ());
- gst_element_register (plugin, "coglogoinsert", GST_RANK_NONE,
- gst_logoinsert_get_type ());
- gst_element_register (plugin, "cogmse", GST_RANK_NONE, gst_mse_get_type ());
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- cog,
- "Cog plugin",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/cog/gstcogdownsample.c b/ext/cog/gstcogdownsample.c
deleted file mode 100644
index 36768e076..000000000
--- a/ext/cog/gstcogdownsample.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2003> 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * This file was (probably) generated from
- * gstvideotemplate.c,v 1.18 2005/11/14 02:13:34 thomasvs Exp
- * and
- * $Id: make_filter,v 1.8 2004/04/19 22:51:57 ds Exp $
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/video/video.h>
-#include <string.h>
-#include <cog/cog.h>
-#include <math.h>
-#include <cog/cogvirtframe.h>
-
-#define GST_TYPE_COGDOWNSAMPLE \
- (gst_cogdownsample_get_type())
-#define GST_COGDOWNSAMPLE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COGDOWNSAMPLE,GstCogdownsample))
-#define GST_COGDOWNSAMPLE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COGDOWNSAMPLE,GstCogdownsampleClass))
-#define GST_IS_COGDOWNSAMPLE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COGDOWNSAMPLE))
-#define GST_IS_COGDOWNSAMPLE_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COGDOWNSAMPLE))
-
-typedef struct _GstCogdownsample GstCogdownsample;
-typedef struct _GstCogdownsampleClass GstCogdownsampleClass;
-
-struct _GstCogdownsample
-{
- GstBaseTransform base_transform;
-
-};
-
-struct _GstCogdownsampleClass
-{
- GstBaseTransformClass parent_class;
-
-};
-
-GType gst_cogdownsample_get_type (void);
-
-enum
-{
- ARG_0
-};
-
-static void gst_cogdownsample_base_init (gpointer g_class);
-static void gst_cogdownsample_class_init (gpointer g_class,
- gpointer class_data);
-static void gst_cogdownsample_init (GTypeInstance * instance, gpointer g_class);
-
-static void gst_cogdownsample_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_cogdownsample_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstCaps *gst_cogdownsample_transform_caps (GstBaseTransform *
- base_transform, GstPadDirection direction, GstCaps * caps);
-static GstFlowReturn gst_cogdownsample_transform (GstBaseTransform *
- base_transform, GstBuffer * inbuf, GstBuffer * outbuf);
-static gboolean gst_cogdownsample_get_unit_size (GstBaseTransform *
- base_transform, GstCaps * caps, guint * size);
-
-static GstStaticPadTemplate gst_cogdownsample_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, UYVY, AYUV }"))
- );
-
-static GstStaticPadTemplate gst_cogdownsample_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, UYVY, AYUV }"))
- );
-
-GType
-gst_cogdownsample_get_type (void)
-{
- static GType compress_type = 0;
-
- if (!compress_type) {
- static const GTypeInfo compress_info = {
- sizeof (GstCogdownsampleClass),
- gst_cogdownsample_base_init,
- NULL,
- gst_cogdownsample_class_init,
- NULL,
- NULL,
- sizeof (GstCogdownsample),
- 0,
- gst_cogdownsample_init,
- };
-
- compress_type = g_type_register_static (GST_TYPE_BASE_TRANSFORM,
- "GstCogdownsample", &compress_info, 0);
- }
- return compress_type;
-}
-
-
-static void
-gst_cogdownsample_base_init (gpointer g_class)
-{
-
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_cogdownsample_src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_cogdownsample_sink_template));
-
- gst_element_class_set_static_metadata (element_class,
- "Scale down video by factor of 2", "Filter/Effect/Video",
- "Scales down video by a factor of 2", "David Schleef <ds@schleef.org>");
-}
-
-static void
-gst_cogdownsample_class_init (gpointer g_class, gpointer class_data)
-{
- GObjectClass *gobject_class;
- GstBaseTransformClass *base_transform_class;
-
- gobject_class = G_OBJECT_CLASS (g_class);
- base_transform_class = GST_BASE_TRANSFORM_CLASS (g_class);
-
- gobject_class->set_property = gst_cogdownsample_set_property;
- gobject_class->get_property = gst_cogdownsample_get_property;
-
- base_transform_class->transform = gst_cogdownsample_transform;
- base_transform_class->transform_caps = gst_cogdownsample_transform_caps;
- base_transform_class->get_unit_size = gst_cogdownsample_get_unit_size;
-}
-
-static void
-gst_cogdownsample_init (GTypeInstance * instance, gpointer g_class)
-{
-
- GST_DEBUG ("gst_cogdownsample_init");
-}
-
-static void
-gst_cogdownsample_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- g_return_if_fail (GST_IS_COGDOWNSAMPLE (object));
-
- GST_DEBUG ("gst_cogdownsample_set_property");
- switch (prop_id) {
- default:
- break;
- }
-}
-
-static void
-gst_cogdownsample_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- g_return_if_fail (GST_IS_COGDOWNSAMPLE (object));
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-transform_value (GValue * dest, const GValue * src, GstPadDirection dir)
-{
- g_value_init (dest, G_VALUE_TYPE (src));
-
- if (G_VALUE_HOLDS_INT (src)) {
- int x;
-
- x = g_value_get_int (src);
- if (dir == GST_PAD_SINK) {
- g_value_set_int (dest, x / 2);
- } else {
- g_value_set_int (dest, x * 2);
- }
- } else if (GST_VALUE_HOLDS_INT_RANGE (src)) {
- int min, max;
-
- min = gst_value_get_int_range_min (src);
- max = gst_value_get_int_range_max (src);
-
- if (dir == GST_PAD_SINK) {
- min = (min + 1) / 2;
- if (max == G_MAXINT) {
- max = G_MAXINT / 2;
- } else {
- max = (max + 1) / 2;
- }
- } else {
- if (max > G_MAXINT / 2) {
- max = G_MAXINT;
- } else {
- max = max * 2;
- }
- if (min > G_MAXINT / 2) {
- min = G_MAXINT;
- } else {
- min = min * 2;
- }
- }
- gst_value_set_int_range (dest, min, max);
- } else {
- /* FIXME */
- g_warning ("case not handled");
- g_value_set_int (dest, 100);
- }
-}
-
-static GstCaps *
-gst_cogdownsample_transform_caps (GstBaseTransform * base_transform,
- GstPadDirection direction, GstCaps * caps)
-{
- int i;
- GstStructure *structure;
- GValue new_value = { 0 };
- const GValue *value;
-
- caps = gst_caps_copy (caps);
-
- for (i = 0; i < gst_caps_get_size (caps); i++) {
- structure = gst_caps_get_structure (caps, i);
-
- value = gst_structure_get_value (structure, "width");
- transform_value (&new_value, value, direction);
- gst_structure_set_value (structure, "width", &new_value);
- g_value_unset (&new_value);
-
- value = gst_structure_get_value (structure, "height");
- transform_value (&new_value, value, direction);
- gst_structure_set_value (structure, "height", &new_value);
- g_value_unset (&new_value);
- }
-
- return caps;
-}
-
-static gboolean
-gst_cogdownsample_get_unit_size (GstBaseTransform * base_transform,
- GstCaps * caps, guint * size)
-{
- int width, height;
- uint32_t format;
-
- gst_structure_get_fourcc (gst_caps_get_structure (caps, 0),
- "format", &format);
- gst_structure_get_int (gst_caps_get_structure (caps, 0), "width", &width);
- gst_structure_get_int (gst_caps_get_structure (caps, 0), "height", &height);
-
- switch (format) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- *size = width * height * 3 / 2;
- break;
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- *size = width * height * 2;
- break;
- case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
- *size = width * height * 4;
- break;
- default:
- g_assert_not_reached ();
- }
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_cogdownsample_transform (GstBaseTransform * base_transform,
- GstBuffer * inbuf, GstBuffer * outbuf)
-{
- CogFrame *outframe;
- int width, height;
- uint32_t format;
- CogFrame *frame;
-
- g_return_val_if_fail (GST_IS_COGDOWNSAMPLE (base_transform), GST_FLOW_ERROR);
-
- gst_structure_get_fourcc (gst_caps_get_structure (inbuf->caps, 0),
- "format", &format);
- gst_structure_get_int (gst_caps_get_structure (inbuf->caps, 0),
- "width", &width);
- gst_structure_get_int (gst_caps_get_structure (inbuf->caps, 0),
- "height", &height);
-
- switch (format) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- frame = cog_frame_new_from_data_I420 (GST_BUFFER_DATA (inbuf),
- width, height);
- outframe = cog_frame_new_from_data_I420 (GST_BUFFER_DATA (outbuf),
- width / 2, height / 2);
- break;
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- frame = cog_frame_new_from_data_YV12 (GST_BUFFER_DATA (inbuf),
- width, height);
- outframe = cog_frame_new_from_data_YV12 (GST_BUFFER_DATA (outbuf),
- width / 2, height / 2);
- break;
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- frame = cog_frame_new_from_data_YUY2 (GST_BUFFER_DATA (inbuf),
- width, height);
- outframe = cog_frame_new_from_data_YUY2 (GST_BUFFER_DATA (outbuf),
- width / 2, height / 2);
- break;
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- frame = cog_frame_new_from_data_UYVY (GST_BUFFER_DATA (inbuf),
- width, height);
- outframe = cog_frame_new_from_data_UYVY (GST_BUFFER_DATA (outbuf),
- width / 2, height / 2);
- break;
- case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
- frame = cog_frame_new_from_data_AYUV (GST_BUFFER_DATA (inbuf),
- width, height);
- outframe = cog_frame_new_from_data_AYUV (GST_BUFFER_DATA (outbuf),
- width / 2, height / 2);
- break;
- default:
- g_assert_not_reached ();
- return GST_FLOW_ERROR;
- }
-
- frame = cog_virt_frame_new_unpack (frame);
- frame = cog_virt_frame_new_horiz_downsample (frame, 3);
- frame = cog_virt_frame_new_vert_downsample (frame, 2);
-
- switch (format) {
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- frame = cog_virt_frame_new_pack_YUY2 (frame);
- break;
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- frame = cog_virt_frame_new_pack_UYVY (frame);
- break;
- case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
- frame = cog_virt_frame_new_pack_AYUV (frame);
- break;
- default:
- break;
- }
-
- cog_virt_frame_render (frame, outframe);
- cog_frame_unref (frame);
- cog_frame_unref (outframe);
-
- return GST_FLOW_OK;
-}
diff --git a/ext/cog/gstcogmse.c b/ext/cog/gstcogmse.c
deleted file mode 100644
index 342342b16..000000000
--- a/ext/cog/gstcogmse.c
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007,2009 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/glib-compat-private.h>
-#include <gst/video/video.h>
-#include <string.h>
-#include <cog/cogframe.h>
-#ifdef HAVE_ORC
-#include <orc/orc.h>
-#endif
-#include <math.h>
-
-#include "gstcogutils.h"
-
-#define GST_CAT_DEFAULT gst_mse_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-#define GST_TYPE_MSE (gst_mse_get_type())
-#define GST_MSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSE,GstMSE))
-#define GST_IS_MSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSE))
-#define GST_MSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_MSE,GstMSEClass))
-#define GST_IS_MSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_MSE))
-#define GST_MSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_MSE,GstMSEClass))
-typedef struct _GstMSE GstMSE;
-typedef struct _GstMSEClass GstMSEClass;
-
-typedef void (*GstMSEProcessFunc) (GstMSE *, guint8 *, guint);
-
-struct _GstMSE
-{
- GstElement element;
-
- /* < private > */
- GstPad *srcpad;
- GstPad *sinkpad_ref;
- GstPad *sinkpad_test;
-
- GstBuffer *buffer_ref;
-
- GMutex *lock;
- GCond *cond;
- gboolean cancel;
-
- GstVideoFormat format;
- int width;
- int height;
-
- double luma_mse_sum;
- double chroma_mse_sum;
- int n_frames;
-};
-
-struct _GstMSEClass
-{
- GstElementClass parent;
-};
-
-GType gst_mse_get_type (void);
-
-
-enum
-{
- PROP_0,
- LUMA_PSNR,
- CHROMA_PSNR
-};
-
-#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_mse_debug, "mse", 0, "cogmse element");
-
-GST_BOILERPLATE_FULL (GstMSE, gst_mse, GstElement,
- GST_TYPE_ELEMENT, DEBUG_INIT);
-
-static void gst_mse_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_mse_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstFlowReturn gst_mse_chain_test (GstPad * pad, GstBuffer * buffer);
-static GstFlowReturn gst_mse_chain_ref (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_mse_sink_event (GstPad * pad, GstEvent * event);
-static void gst_mse_reset (GstMSE * filter);
-static GstCaps *gst_mse_getcaps (GstPad * pad);
-static gboolean gst_mse_set_caps (GstPad * pad, GstCaps * outcaps);
-static void gst_mse_finalize (GObject * object);
-
-static void cog_frame_mse (CogFrame * a, CogFrame * b, double *mse);
-static double mse_to_db (double mse, gboolean is_chroma);
-
-
-static GstStaticPadTemplate gst_framestore_sink_ref_template =
-GST_STATIC_PAD_TEMPLATE ("sink_ref",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{I420,YUY2,AYUV}"))
- );
-
-static GstStaticPadTemplate gst_framestore_sink_test_template =
-GST_STATIC_PAD_TEMPLATE ("sink_test",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{I420,YUY2,AYUV}"))
- );
-
-static GstStaticPadTemplate gst_framestore_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{I420,YUY2,AYUV}"))
- );
-
-static void
-gst_mse_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_framestore_src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_framestore_sink_ref_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_framestore_sink_test_template));
-
- gst_element_class_set_static_metadata (element_class, "Calculate MSE",
- "Filter/Effect",
- "Calculates mean squared error between two video streams",
- "David Schleef <ds@schleef.org>");
-}
-
-static void
-gst_mse_class_init (GstMSEClass * klass)
-{
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *) klass;
- gobject_class->set_property = gst_mse_set_property;
- gobject_class->get_property = gst_mse_get_property;
-
- gobject_class->finalize = gst_mse_finalize;
-
- g_object_class_install_property (gobject_class, LUMA_PSNR,
- g_param_spec_double ("luma-psnr", "luma-psnr", "luma-psnr",
- 0, 70, 40, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, CHROMA_PSNR,
- g_param_spec_double ("chroma-psnr", "chroma-psnr", "chroma-psnr",
- 0, 70, 40, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-}
-
-static void
-gst_mse_init (GstMSE * filter, GstMSEClass * klass)
-{
- gst_element_create_all_pads (GST_ELEMENT (filter));
-
- filter->srcpad = gst_element_get_static_pad (GST_ELEMENT (filter), "src");
-
- gst_pad_set_getcaps_function (filter->srcpad, gst_mse_getcaps);
-
- filter->sinkpad_ref =
- gst_element_get_static_pad (GST_ELEMENT (filter), "sink_ref");
-
- gst_pad_set_chain_function (filter->sinkpad_ref, gst_mse_chain_ref);
- gst_pad_set_event_function (filter->sinkpad_ref, gst_mse_sink_event);
- gst_pad_set_getcaps_function (filter->sinkpad_ref, gst_mse_getcaps);
-
- filter->sinkpad_test =
- gst_element_get_static_pad (GST_ELEMENT (filter), "sink_test");
-
- gst_pad_set_chain_function (filter->sinkpad_test, gst_mse_chain_test);
- gst_pad_set_event_function (filter->sinkpad_test, gst_mse_sink_event);
- gst_pad_set_getcaps_function (filter->sinkpad_test, gst_mse_getcaps);
- gst_pad_set_setcaps_function (filter->sinkpad_test, gst_mse_set_caps);
-
- gst_mse_reset (filter);
-
- filter->cond = g_cond_new ();
- filter->lock = g_mutex_new ();
-}
-
-static void
-gst_mse_finalize (GObject * object)
-{
- GstMSE *fs = GST_MSE (object);
-
- gst_object_unref (fs->srcpad);
- gst_object_unref (fs->sinkpad_ref);
- gst_object_unref (fs->sinkpad_test);
- g_mutex_free (fs->lock);
- g_cond_free (fs->cond);
- gst_buffer_replace (&fs->buffer_ref, NULL);
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static GstCaps *
-gst_mse_getcaps (GstPad * pad)
-{
- GstMSE *fs;
- GstCaps *caps;
- GstCaps *icaps;
- GstCaps *peercaps;
-
- fs = GST_MSE (gst_pad_get_parent (pad));
-
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
-
- if (pad != fs->srcpad) {
- peercaps = gst_pad_peer_get_caps (fs->srcpad);
- if (peercaps) {
- icaps = gst_caps_intersect (caps, peercaps);
- gst_caps_unref (caps);
- gst_caps_unref (peercaps);
- caps = icaps;
- }
- }
-
- if (pad != fs->sinkpad_ref) {
- peercaps = gst_pad_peer_get_caps (fs->sinkpad_ref);
- if (peercaps) {
- icaps = gst_caps_intersect (caps, peercaps);
- gst_caps_unref (caps);
- gst_caps_unref (peercaps);
- caps = icaps;
- }
- }
-
- if (pad != fs->sinkpad_test) {
- peercaps = gst_pad_peer_get_caps (fs->sinkpad_test);
- if (peercaps) {
- icaps = gst_caps_intersect (caps, peercaps);
- gst_caps_unref (caps);
- gst_caps_unref (peercaps);
- caps = icaps;
- }
- }
-
- gst_object_unref (fs);
-
- return caps;
-}
-
-static gboolean
-gst_mse_set_caps (GstPad * pad, GstCaps * caps)
-{
- GstMSE *fs;
-
- fs = GST_MSE (gst_pad_get_parent (pad));
-
- gst_video_format_parse_caps (caps, &fs->format, &fs->width, &fs->height);
-
- gst_object_unref (fs);
-
- return TRUE;
-}
-
-static void
-gst_mse_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_mse_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstMSE *fs = GST_MSE (object);
-
- switch (prop_id) {
- case LUMA_PSNR:
- g_value_set_double (value,
- mse_to_db (fs->luma_mse_sum / fs->n_frames, FALSE));
- break;
- case CHROMA_PSNR:
- g_value_set_double (value,
- mse_to_db (fs->chroma_mse_sum / fs->n_frames, TRUE));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_mse_reset (GstMSE * fs)
-{
- fs->luma_mse_sum = 0;
- fs->chroma_mse_sum = 0;
- fs->n_frames = 0;
- fs->cancel = FALSE;
-
- if (fs->buffer_ref) {
- gst_buffer_unref (fs->buffer_ref);
- fs->buffer_ref = NULL;
- }
-}
-
-
-static GstFlowReturn
-gst_mse_chain_ref (GstPad * pad, GstBuffer * buffer)
-{
- GstMSE *fs;
-
- fs = GST_MSE (gst_pad_get_parent (pad));
-
- GST_DEBUG ("chain ref");
-
- g_mutex_lock (fs->lock);
- while (fs->buffer_ref) {
- GST_DEBUG ("waiting for ref buffer clear");
- g_cond_wait (fs->cond, fs->lock);
- if (fs->cancel) {
- g_mutex_unlock (fs->lock);
- gst_object_unref (fs);
- return GST_FLOW_FLUSHING;
- }
- }
-
- fs->buffer_ref = buffer;
- g_cond_signal (fs->cond);
-
- g_mutex_unlock (fs->lock);
-
- gst_object_unref (fs);
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_mse_chain_test (GstPad * pad, GstBuffer * buffer)
-{
- GstMSE *fs;
- GstFlowReturn ret;
- GstBuffer *buffer_ref;
-
- fs = GST_MSE (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (fs, "chain test");
-
- g_mutex_lock (fs->lock);
- while (fs->buffer_ref == NULL) {
- GST_DEBUG_OBJECT (fs, "waiting for ref buffer");
- g_cond_wait (fs->cond, fs->lock);
- if (fs->cancel) {
- g_mutex_unlock (fs->lock);
- gst_object_unref (fs);
- return GST_FLOW_FLUSHING;
- }
- }
-
- buffer_ref = fs->buffer_ref;
- fs->buffer_ref = NULL;
- g_cond_signal (fs->cond);
-
- g_mutex_unlock (fs->lock);
-
- if (1) {
- CogFrame *frame_ref;
- CogFrame *frame_test;
- double mse[3];
-
- frame_ref = gst_cog_buffer_wrap (gst_buffer_ref (buffer_ref), fs->format,
- fs->width, fs->height);
- frame_test = gst_cog_buffer_wrap (gst_buffer_ref (buffer), fs->format,
- fs->width, fs->height);
-
- cog_frame_mse (frame_ref, frame_test, mse);
-
- GST_INFO ("mse %g %g %g", mse_to_db (mse[0], FALSE),
- mse_to_db (mse[1], TRUE), mse_to_db (mse[2], TRUE));
-
- fs->luma_mse_sum += mse[0];
- fs->chroma_mse_sum += 0.5 * (mse[1] + mse[2]);
- fs->n_frames++;
-
- cog_frame_unref (frame_ref);
- cog_frame_unref (frame_test);
- }
-
-
- ret = gst_pad_push (fs->srcpad, buffer);
- gst_buffer_unref (buffer_ref);
-
- gst_object_unref (fs);
-
- return ret;
-}
-
-static gboolean
-gst_mse_sink_event (GstPad * pad, GstEvent * event)
-{
- GstMSE *fs;
-
- fs = GST_MSE (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- double rate;
- double applied_rate;
- GstFormat format;
- gint64 start, stop, position;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
- &format, &start, &stop, &position);
-
- GST_DEBUG ("new_segment %d %g %g %d %" G_GINT64_FORMAT
- " %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
- update, rate, applied_rate, format, start, stop, position);
-
- }
- break;
- case GST_EVENT_FLUSH_START:
- GST_DEBUG ("flush start");
- fs->cancel = TRUE;
- break;
- case GST_EVENT_FLUSH_STOP:
- GST_DEBUG ("flush stop");
- fs->cancel = FALSE;
- break;
- default:
- break;
- }
-
- gst_pad_push_event (fs->srcpad, event);
- gst_object_unref (fs);
-
- return TRUE;
-}
-
-static int
-sum_square_diff_u8 (uint8_t * s1, uint8_t * s2, int n)
-{
-#ifndef HAVE_ORC
- int sum = 0;
- int i;
- int x;
-
- for (i = 0; i < n; i++) {
- x = s1[i] - s2[i];
- sum += x * x;
- }
- return sum;
-#else
- static OrcProgram *p = NULL;
- OrcExecutor *ex;
- int val;
-
- if (p == NULL) {
- OrcCompileResult ret;
-
- p = orc_program_new_ass (4, 1, 1);
- orc_program_add_temporary (p, 2, "t1");
- orc_program_add_temporary (p, 2, "t2");
- orc_program_add_temporary (p, 4, "t3");
-
- orc_program_append_ds_str (p, "convubw", "t1", "s1");
- orc_program_append_ds_str (p, "convubw", "t2", "s2");
- orc_program_append_str (p, "subw", "t1", "t1", "t2");
- orc_program_append_str (p, "mullw", "t1", "t1", "t1");
- orc_program_append_ds_str (p, "convuwl", "t3", "t1");
- orc_program_append_ds_str (p, "accl", "a1", "t3");
-
- ret = orc_program_compile (p);
- if (!ORC_COMPILE_RESULT_IS_SUCCESSFUL (ret)) {
- GST_ERROR ("Orc compiler failure");
- return 0;
- }
- }
-
- ex = orc_executor_new (p);
- orc_executor_set_n (ex, n);
- orc_executor_set_array_str (ex, "s1", s1);
- orc_executor_set_array_str (ex, "s2", s2);
-
- orc_executor_run (ex);
- val = orc_executor_get_accumulator (ex, 0);
- orc_executor_free (ex);
-
- return val;
-#endif
-}
-
-static double
-cog_frame_component_squared_error (CogFrameData * a, CogFrameData * b)
-{
- int j;
- double sum;
-
- g_return_val_if_fail (a->width == b->width, 0.0);
- g_return_val_if_fail (a->height == b->height, 0.0);
-
- sum = 0;
- for (j = 0; j < a->height; j++) {
- sum += sum_square_diff_u8 (COG_FRAME_DATA_GET_LINE (a, j),
- COG_FRAME_DATA_GET_LINE (b, j), a->width);
- }
- return sum;
-}
-
-static void
-cog_frame_mse (CogFrame * a, CogFrame * b, double *mse)
-{
- double sum, n;
-
- sum = cog_frame_component_squared_error (&a->components[0],
- &b->components[0]);
- n = a->components[0].width * a->components[0].height;
- mse[0] = sum / n;
-
- sum = cog_frame_component_squared_error (&a->components[1],
- &b->components[1]);
- n = a->components[1].width * a->components[1].height;
- mse[1] = sum / n;
-
- sum = cog_frame_component_squared_error (&a->components[2],
- &b->components[2]);
- n = a->components[2].width * a->components[2].height;
- mse[2] = sum / n;
-}
-
-static double
-mse_to_db (double mse, gboolean is_chroma)
-{
- if (is_chroma) {
- return 10.0 * log (mse / (224.0 * 224.0)) / log (10.0);
- } else {
- return 10.0 * log (mse / (219.0 * 219.0)) / log (10.0);
- }
-}
diff --git a/ext/cog/gstcogorc-dist.c b/ext/cog/gstcogorc-dist.c
deleted file mode 100644
index 3503b4d21..000000000
--- a/ext/cog/gstcogorc-dist.c
+++ /dev/null
@@ -1,15553 +0,0 @@
-
-/* autogenerated from gstcogorc.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 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_downsample_horiz_cosite_1tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, int n);
-void cogorc_downsample_horiz_cosite_3tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2,
- int n);
-void cogorc_downsample_420_jpeg (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2,
- int n);
-void cogorc_downsample_vert_halfsite_2tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- int n);
-void cogorc_downsample_vert_cosite_3tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, int n);
-void cogorc_downsample_vert_halfsite_4tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4,
- int n);
-void cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, int n);
-void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- int n);
-void cogorc_upsample_vert_avgub (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- int n);
-void orc_unpack_yuyv_y (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, int n);
-void orc_unpack_yuyv_u (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n);
-void orc_unpack_yuyv_v (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n);
-void orc_pack_yuyv (orc_uint32 * ORC_RESTRICT d1,
- const guint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, int n);
-void orc_unpack_uyvy_y (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, int n);
-void orc_unpack_uyvy_u (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n);
-void orc_unpack_uyvy_v (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n);
-void orc_pack_uyvy (orc_uint32 * ORC_RESTRICT d1,
- const guint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, int n);
-void orc_addc_convert_u8_s16 (orc_uint8 * ORC_RESTRICT d1,
- const gint16 * ORC_RESTRICT s1, int n);
-void orc_subc_convert_s16_u8 (gint16 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, int n);
-void orc_splat_u8_ns (orc_uint8 * ORC_RESTRICT d1, int p1, int n);
-void orc_splat_s16_ns (gint16 * ORC_RESTRICT d1, int p1, 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 orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, int p1, int n);
-void orc_pack_x123 (guint32 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, int p1, int n);
-void cogorc_combine2_u8 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- int p1, int p2, int n);
-void cogorc_combine4_u8 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4,
- int p1, int p2, int p3, int p4, int n);
-void cogorc_unpack_axyz_0 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n);
-void cogorc_unpack_axyz_1 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n);
-void cogorc_unpack_axyz_2 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n);
-void cogorc_unpack_axyz_3 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n);
-void cogorc_resample_horiz_1tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n);
-void cogorc_resample_horiz_2tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n);
-void cogorc_convert_I420_UYVY (orc_uint32 * ORC_RESTRICT d1,
- orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1,
- const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- const orc_uint8 * ORC_RESTRICT s4, int n);
-void cogorc_convert_I420_YUY2 (orc_uint32 * ORC_RESTRICT d1,
- orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1,
- const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- const orc_uint8 * ORC_RESTRICT s4, int n);
-void cogorc_convert_I420_AYUV (orc_uint32 * ORC_RESTRICT d1,
- orc_uint32 * ORC_RESTRICT d2, const orc_uint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- const orc_uint8 * ORC_RESTRICT s4, int n);
-void cogorc_convert_YUY2_I420 (orc_uint16 * ORC_RESTRICT d1,
- orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3,
- orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1,
- const orc_uint32 * ORC_RESTRICT s2, int n);
-void cogorc_convert_UYVY_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_420_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_420_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_422_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_444_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_444_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint16 * ORC_RESTRICT s2, int s2_stride, int n, int m);
-void cogorc_planar_chroma_422_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
-void cogorc_convert_YUY2_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_UYVY_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_YUY2_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m);
-void cogorc_convert_UYVY_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m);
-void cogorc_convert_YUY2_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m);
-void cogorc_convert_UYVY_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m);
-void cogorc_convert_UYVY_I420 (orc_uint16 * ORC_RESTRICT d1,
- orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3,
- orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1,
- const orc_uint32 * ORC_RESTRICT s2, int n);
-void cogorc_convert_AYUV_I420 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, orc_uint8 * ORC_RESTRICT d4, int d4_stride,
- const orc_uint64 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint64 * ORC_RESTRICT s2, int s2_stride, int n, int m);
-void cogorc_convert_AYUV_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n,
- int m);
-void cogorc_convert_AYUV_Y444 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m);
-void cogorc_convert_Y42B_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y42B_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y42B_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y444_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint16 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y444_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint16 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y444_AYUV (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_AYUV_ARGB (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_BGRA (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_ABGR (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_RGBA (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_I420_BGRA (orc_uint32 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, int n);
-void cogorc_convert_I420_BGRA_avg (orc_uint32 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4,
- const orc_uint8 * ORC_RESTRICT s5, 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 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * 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 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_downsample_horiz_cosite_1tap */
-#ifdef DISABLE_ORC
-void
-cogorc_downsample_horiz_cosite_1tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_downsample_horiz_cosite_3tap */
-#ifdef DISABLE_ORC
-void
-cogorc_downsample_horiz_cosite_3tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2,
- int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
- ex->arrays[ORC_VAR_S2] = (void *) s2;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_downsample_420_jpeg */
-#ifdef DISABLE_ORC
-void
-cogorc_downsample_420_jpeg (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2,
- int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
- ex->arrays[ORC_VAR_S2] = (void *) s2;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_downsample_vert_halfsite_2tap */
-#ifdef DISABLE_ORC
-void
-cogorc_downsample_vert_halfsite_2tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
- ex->arrays[ORC_VAR_S2] = (void *) s2;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_downsample_vert_cosite_3tap */
-#ifdef DISABLE_ORC
-void
-cogorc_downsample_vert_cosite_3tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_downsample_vert_halfsite_4tap */
-#ifdef DISABLE_ORC
-void
-cogorc_downsample_vert_halfsite_4tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_upsample_horiz_cosite_1tap */
-#ifdef DISABLE_ORC
-void
-cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1,
- const orc_uint8 * 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 orc_uint8 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_upsample_horiz_cosite */
-#ifdef DISABLE_ORC
-void
-cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * 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 orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
- ex->arrays[ORC_VAR_S2] = (void *) s2;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_upsample_vert_avgub */
-#ifdef DISABLE_ORC
-void
-cogorc_upsample_vert_avgub (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
- ex->arrays[ORC_VAR_S2] = (void *) s2;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_unpack_yuyv_y */
-#ifdef DISABLE_ORC
-void
-orc_unpack_yuyv_y (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_unpack_yuyv_u */
-#ifdef DISABLE_ORC
-void
-orc_unpack_yuyv_u (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_unpack_yuyv_v */
-#ifdef DISABLE_ORC
-void
-orc_unpack_yuyv_v (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_pack_yuyv */
-#ifdef DISABLE_ORC
-void
-orc_pack_yuyv (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_unpack_uyvy_y */
-#ifdef DISABLE_ORC
-void
-orc_unpack_uyvy_y (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint16 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_unpack_uyvy_u */
-#ifdef DISABLE_ORC
-void
-orc_unpack_uyvy_u (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_unpack_uyvy_v */
-#ifdef DISABLE_ORC
-void
-orc_unpack_uyvy_v (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_pack_uyvy */
-#ifdef DISABLE_ORC
-void
-orc_pack_uyvy (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_addc_convert_u8_s16 */
-#ifdef DISABLE_ORC
-void
-orc_addc_convert_u8_s16 (orc_uint8 * ORC_RESTRICT d1,
- const gint16 * ORC_RESTRICT s1, int n)
-{
- int i;
- orc_int8 *ORC_RESTRICT ptr0;
- const orc_union16 *ORC_RESTRICT ptr4;
- orc_union16 var33;
- orc_union16 var34;
- orc_int8 var35;
- orc_union16 var36;
-
- ptr0 = (orc_int8 *) d1;
- ptr4 = (orc_union16 *) s1;
-
- /* 1: loadpw */
- var34.i = (int) 0x00000080; /* 128 or 6.32404e-322f */
-
- for (i = 0; i < n; i++) {
- /* 0: loadw */
- var33 = ptr4[i];
- /* 2: addw */
- var36.i = var33.i + var34.i;
- /* 3: convsuswb */
- var35 = ORC_CLAMP_UB (var36.i);
- /* 4: storeb */
- ptr0[i] = var35;
- }
-
-}
-
-#else
-static void
-_backup_orc_addc_convert_u8_s16 (OrcExecutor * ORC_RESTRICT ex)
-{
- int i;
- int n = ex->n;
- orc_int8 *ORC_RESTRICT ptr0;
- const orc_union16 *ORC_RESTRICT ptr4;
- orc_union16 var33;
- orc_union16 var34;
- orc_int8 var35;
- orc_union16 var36;
-
- ptr0 = (orc_int8 *) ex->arrays[0];
- ptr4 = (orc_union16 *) ex->arrays[4];
-
- /* 1: loadpw */
- var34.i = (int) 0x00000080; /* 128 or 6.32404e-322f */
-
- for (i = 0; i < n; i++) {
- /* 0: loadw */
- var33 = ptr4[i];
- /* 2: addw */
- var36.i = var33.i + var34.i;
- /* 3: convsuswb */
- var35 = ORC_CLAMP_UB (var36.i);
- /* 4: storeb */
- ptr0[i] = var35;
- }
-
-}
-
-void
-orc_addc_convert_u8_s16 (orc_uint8 * ORC_RESTRICT d1,
- const gint16 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "orc_addc_convert_u8_s16");
- orc_program_set_backup_function (p, _backup_orc_addc_convert_u8_s16);
- orc_program_add_destination (p, 1, "d1");
- orc_program_add_source (p, 2, "s1");
- orc_program_add_constant (p, 4, 0x00000080, "c1");
- orc_program_add_temporary (p, 2, "t1");
-
- orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_S1, 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_subc_convert_s16_u8 */
-#ifdef DISABLE_ORC
-void
-orc_subc_convert_s16_u8 (gint16 * ORC_RESTRICT d1,
- const orc_uint8 * 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_union16 var35;
- orc_union16 var36;
-
- ptr0 = (orc_union16 *) d1;
- ptr4 = (orc_int8 *) s1;
-
- /* 2: loadpw */
- var34.i = (int) 0x00000080; /* 128 or 6.32404e-322f */
-
- for (i = 0; i < n; i++) {
- /* 0: loadb */
- var33 = ptr4[i];
- /* 1: convubw */
- var36.i = (orc_uint8) var33;
- /* 3: subw */
- var35.i = var36.i - var34.i;
- /* 4: storew */
- ptr0[i] = var35;
- }
-
-}
-
-#else
-static void
-_backup_orc_subc_convert_s16_u8 (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_union16 var35;
- orc_union16 var36;
-
- ptr0 = (orc_union16 *) ex->arrays[0];
- ptr4 = (orc_int8 *) ex->arrays[4];
-
- /* 2: loadpw */
- var34.i = (int) 0x00000080; /* 128 or 6.32404e-322f */
-
- for (i = 0; i < n; i++) {
- /* 0: loadb */
- var33 = ptr4[i];
- /* 1: convubw */
- var36.i = (orc_uint8) var33;
- /* 3: subw */
- var35.i = var36.i - var34.i;
- /* 4: storew */
- ptr0[i] = var35;
- }
-
-}
-
-void
-orc_subc_convert_s16_u8 (gint16 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "orc_subc_convert_s16_u8");
- orc_program_set_backup_function (p, _backup_orc_subc_convert_s16_u8);
- orc_program_add_destination (p, 2, "d1");
- orc_program_add_source (p, 1, "s1");
- orc_program_add_constant (p, 4, 0x00000080, "c1");
- orc_program_add_temporary (p, 2, "t1");
-
- 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_D1, ORC_VAR_T1, ORC_VAR_C1,
- ORC_VAR_D1);
-
- orc_program_compile (p);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_splat_u8_ns */
-#ifdef DISABLE_ORC
-void
-orc_splat_u8_ns (orc_uint8 * ORC_RESTRICT d1, int p1, int n)
-{
- int i;
- orc_int8 *ORC_RESTRICT ptr0;
- orc_int8 var32;
- orc_int8 var33;
-
- ptr0 = (orc_int8 *) d1;
-
- /* 0: loadpb */
- var32 = p1;
-
- for (i = 0; i < n; i++) {
- /* 1: copyb */
- var33 = var32;
- /* 2: storeb */
- ptr0[i] = var33;
- }
-
-}
-
-#else
-static void
-_backup_orc_splat_u8_ns (OrcExecutor * ORC_RESTRICT ex)
-{
- int i;
- int n = ex->n;
- orc_int8 *ORC_RESTRICT ptr0;
- orc_int8 var32;
- orc_int8 var33;
-
- ptr0 = (orc_int8 *) ex->arrays[0];
-
- /* 0: loadpb */
- var32 = ex->params[24];
-
- for (i = 0; i < n; i++) {
- /* 1: copyb */
- var33 = var32;
- /* 2: storeb */
- ptr0[i] = var33;
- }
-
-}
-
-void
-orc_splat_u8_ns (orc_uint8 * ORC_RESTRICT d1, int p1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "orc_splat_u8_ns");
- orc_program_set_backup_function (p, _backup_orc_splat_u8_ns);
- orc_program_add_destination (p, 1, "d1");
- orc_program_add_parameter (p, 1, "p1");
-
- orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_P1, ORC_VAR_D1,
- ORC_VAR_D1);
-
- orc_program_compile (p);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->params[ORC_VAR_P1] = p1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_splat_s16_ns */
-#ifdef DISABLE_ORC
-void
-orc_splat_s16_ns (gint16 * ORC_RESTRICT d1, int p1, int n)
-{
- int i;
- orc_union16 *ORC_RESTRICT ptr0;
- orc_union16 var32;
- orc_union16 var33;
-
- ptr0 = (orc_union16 *) d1;
-
- /* 0: loadpw */
- var32.i = p1;
-
- for (i = 0; i < n; i++) {
- /* 1: copyw */
- var33.i = var32.i;
- /* 2: storew */
- ptr0[i] = var33;
- }
-
-}
-
-#else
-static void
-_backup_orc_splat_s16_ns (OrcExecutor * ORC_RESTRICT ex)
-{
- int i;
- int n = ex->n;
- orc_union16 *ORC_RESTRICT ptr0;
- orc_union16 var32;
- orc_union16 var33;
-
- ptr0 = (orc_union16 *) ex->arrays[0];
-
- /* 0: loadpw */
- var32.i = ex->params[24];
-
- for (i = 0; i < n; i++) {
- /* 1: copyw */
- var33.i = var32.i;
- /* 2: storew */
- ptr0[i] = var33;
- }
-
-}
-
-void
-orc_splat_s16_ns (gint16 * ORC_RESTRICT d1, int p1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "orc_splat_s16_ns");
- orc_program_set_backup_function (p, _backup_orc_splat_s16_ns);
- orc_program_add_destination (p, 2, "d1");
- orc_program_add_parameter (p, 2, "p1");
-
- orc_program_append_2 (p, "copyw", 0, ORC_VAR_D1, ORC_VAR_P1, ORC_VAR_D1,
- ORC_VAR_D1);
-
- orc_program_compile (p);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->params[ORC_VAR_P1] = p1;
-
- func = c->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 volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->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 volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->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 volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->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 volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->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 volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->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 volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->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 volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_pack_123x */
-#ifdef DISABLE_ORC
-void
-orc_pack_123x (guint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * 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 orc_uint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- int p1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* orc_pack_x123 */
-#ifdef DISABLE_ORC
-void
-orc_pack_x123 (guint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * 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 orc_uint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- int p1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_combine2_u8 */
-#ifdef DISABLE_ORC
-void
-cogorc_combine2_u8 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * 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 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- int p1, int p2, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_combine4_u8 */
-#ifdef DISABLE_ORC
-void
-cogorc_combine4_u8 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4,
- 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;
- const orc_int8 *ORC_RESTRICT ptr7;
- orc_int8 var34;
- orc_union16 var35;
- orc_int8 var36;
- orc_union16 var37;
- orc_int8 var38;
- orc_union16 var39;
- orc_int8 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;
- orc_union16 var56;
-
- ptr0 = (orc_int8 *) d1;
- ptr4 = (orc_int8 *) s1;
- ptr5 = (orc_int8 *) s2;
- ptr6 = (orc_int8 *) s3;
- ptr7 = (orc_int8 *) s4;
-
- /* 2: loadpw */
- var35.i = p1;
- /* 6: loadpw */
- var37.i = p2;
- /* 11: loadpw */
- var39.i = p3;
- /* 16: loadpw */
- var41.i = p4;
- /* 19: loadpw */
- var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */
-
- for (i = 0; i < n; i++) {
- /* 0: loadb */
- var34 = ptr4[i];
- /* 1: convubw */
- var44.i = (orc_uint8) var34;
- /* 3: mullw */
- var45.i = (var44.i * var35.i) & 0xffff;
- /* 4: loadb */
- var36 = ptr5[i];
- /* 5: convubw */
- var46.i = (orc_uint8) var36;
- /* 7: mullw */
- var47.i = (var46.i * var37.i) & 0xffff;
- /* 8: addw */
- var48.i = var45.i + var47.i;
- /* 9: loadb */
- var38 = ptr6[i];
- /* 10: convubw */
- var49.i = (orc_uint8) var38;
- /* 12: mullw */
- var50.i = (var49.i * var39.i) & 0xffff;
- /* 13: addw */
- var51.i = var48.i + var50.i;
- /* 14: loadb */
- var40 = ptr7[i];
- /* 15: convubw */
- var52.i = (orc_uint8) var40;
- /* 17: mullw */
- var53.i = (var52.i * var41.i) & 0xffff;
- /* 18: addw */
- var54.i = var51.i + var53.i;
- /* 20: addw */
- var55.i = var54.i + var42.i;
- /* 21: shrsw */
- var56.i = var55.i >> 6;
- /* 22: convsuswb */
- var43 = ORC_CLAMP_UB (var56.i);
- /* 23: storeb */
- ptr0[i] = var43;
- }
-
-}
-
-#else
-static void
-_backup_cogorc_combine4_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;
- const orc_int8 *ORC_RESTRICT ptr7;
- orc_int8 var34;
- orc_union16 var35;
- orc_int8 var36;
- orc_union16 var37;
- orc_int8 var38;
- orc_union16 var39;
- orc_int8 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;
- orc_union16 var56;
-
- 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];
-
- /* 2: loadpw */
- var35.i = ex->params[24];
- /* 6: loadpw */
- var37.i = ex->params[25];
- /* 11: loadpw */
- var39.i = ex->params[26];
- /* 16: loadpw */
- var41.i = ex->params[27];
- /* 19: loadpw */
- var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */
-
- for (i = 0; i < n; i++) {
- /* 0: loadb */
- var34 = ptr4[i];
- /* 1: convubw */
- var44.i = (orc_uint8) var34;
- /* 3: mullw */
- var45.i = (var44.i * var35.i) & 0xffff;
- /* 4: loadb */
- var36 = ptr5[i];
- /* 5: convubw */
- var46.i = (orc_uint8) var36;
- /* 7: mullw */
- var47.i = (var46.i * var37.i) & 0xffff;
- /* 8: addw */
- var48.i = var45.i + var47.i;
- /* 9: loadb */
- var38 = ptr6[i];
- /* 10: convubw */
- var49.i = (orc_uint8) var38;
- /* 12: mullw */
- var50.i = (var49.i * var39.i) & 0xffff;
- /* 13: addw */
- var51.i = var48.i + var50.i;
- /* 14: loadb */
- var40 = ptr7[i];
- /* 15: convubw */
- var52.i = (orc_uint8) var40;
- /* 17: mullw */
- var53.i = (var52.i * var41.i) & 0xffff;
- /* 18: addw */
- var54.i = var51.i + var53.i;
- /* 20: addw */
- var55.i = var54.i + var42.i;
- /* 21: shrsw */
- var56.i = var55.i >> 6;
- /* 22: convsuswb */
- var43 = ORC_CLAMP_UB (var56.i);
- /* 23: storeb */
- ptr0[i] = var43;
- }
-
-}
-
-void
-cogorc_combine4_u8 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4,
- int p1, int p2, int p3, int p4, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "cogorc_combine4_u8");
- orc_program_set_backup_function (p, _backup_cogorc_combine4_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_source (p, 1, "s4");
- orc_program_add_constant (p, 4, 0x00000020, "c1");
- orc_program_add_constant (p, 4, 0x00000006, "c2");
- 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, "convubw", 0, ORC_VAR_T2, ORC_VAR_S4, ORC_VAR_D1,
- ORC_VAR_D1);
- orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P4,
- 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_C2,
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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->params[ORC_VAR_P1] = p1;
- ex->params[ORC_VAR_P2] = p2;
- ex->params[ORC_VAR_P3] = p3;
- ex->params[ORC_VAR_P4] = p4;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_unpack_axyz_0 */
-#ifdef DISABLE_ORC
-void
-cogorc_unpack_axyz_0 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * 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_cogorc_unpack_axyz_0 (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
-cogorc_unpack_axyz_0 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "cogorc_unpack_axyz_0");
- orc_program_set_backup_function (p, _backup_cogorc_unpack_axyz_0);
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_unpack_axyz_1 */
-#ifdef DISABLE_ORC
-void
-cogorc_unpack_axyz_1 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * 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_unpack_axyz_1 (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_unpack_axyz_1 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "cogorc_unpack_axyz_1");
- orc_program_set_backup_function (p, _backup_cogorc_unpack_axyz_1);
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_unpack_axyz_2 */
-#ifdef DISABLE_ORC
-void
-cogorc_unpack_axyz_2 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * 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_cogorc_unpack_axyz_2 (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
-cogorc_unpack_axyz_2 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "cogorc_unpack_axyz_2");
- orc_program_set_backup_function (p, _backup_cogorc_unpack_axyz_2);
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_unpack_axyz_3 */
-#ifdef DISABLE_ORC
-void
-cogorc_unpack_axyz_3 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * 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_cogorc_unpack_axyz_3 (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
-cogorc_unpack_axyz_3 (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint32 * ORC_RESTRICT s1, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "cogorc_unpack_axyz_3");
- orc_program_set_backup_function (p, _backup_cogorc_unpack_axyz_3);
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_resample_horiz_1tap */
-#ifdef DISABLE_ORC
-void
-cogorc_resample_horiz_1tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n)
-{
- int i;
- orc_int8 *ORC_RESTRICT ptr0;
- const orc_int8 *ORC_RESTRICT ptr4;
- orc_int8 var32;
-
- ptr0 = (orc_int8 *) d1;
- ptr4 = (orc_int8 *) s1;
-
-
- for (i = 0; i < n; i++) {
- /* 0: ldresnearb */
- var32 = ptr4[(p1 + i * p2) >> 16];
- /* 1: storeb */
- ptr0[i] = var32;
- }
-
-}
-
-#else
-static void
-_backup_cogorc_resample_horiz_1tap (OrcExecutor * ORC_RESTRICT ex)
-{
- int i;
- int n = ex->n;
- orc_int8 *ORC_RESTRICT ptr0;
- const orc_int8 *ORC_RESTRICT ptr4;
- orc_int8 var32;
-
- ptr0 = (orc_int8 *) ex->arrays[0];
- ptr4 = (orc_int8 *) ex->arrays[4];
-
-
- for (i = 0; i < n; i++) {
- /* 0: ldresnearb */
- var32 = ptr4[(ex->params[24] + i * ex->params[25]) >> 16];
- /* 1: storeb */
- ptr0[i] = var32;
- }
-
-}
-
-void
-cogorc_resample_horiz_1tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "cogorc_resample_horiz_1tap");
- orc_program_set_backup_function (p, _backup_cogorc_resample_horiz_1tap);
- orc_program_add_destination (p, 1, "d1");
- orc_program_add_source (p, 1, "s1");
- orc_program_add_parameter (p, 4, "p1");
- orc_program_add_parameter (p, 4, "p2");
-
- orc_program_append_2 (p, "ldresnearb", 0, ORC_VAR_D1, ORC_VAR_S1,
- ORC_VAR_P1, ORC_VAR_P2);
-
- orc_program_compile (p);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
- ex->params[ORC_VAR_P1] = p1;
- ex->params[ORC_VAR_P2] = p2;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_resample_horiz_2tap */
-#ifdef DISABLE_ORC
-void
-cogorc_resample_horiz_2tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n)
-{
- int i;
- orc_int8 *ORC_RESTRICT ptr0;
- const orc_int8 *ORC_RESTRICT ptr4;
- orc_int8 var32;
-
- ptr0 = (orc_int8 *) d1;
- ptr4 = (orc_int8 *) s1;
-
-
- for (i = 0; i < n; i++) {
- /* 0: ldreslinb */
- {
- int tmp = p1 + i * p2;
- var32 =
- ((orc_uint8) ptr4[tmp >> 16] * (256 - ((tmp >> 8) & 0xff)) +
- (orc_uint8) ptr4[(tmp >> 16) + 1] * ((tmp >> 8) & 0xff)) >> 8;
- }
- /* 1: storeb */
- ptr0[i] = var32;
- }
-
-}
-
-#else
-static void
-_backup_cogorc_resample_horiz_2tap (OrcExecutor * ORC_RESTRICT ex)
-{
- int i;
- int n = ex->n;
- orc_int8 *ORC_RESTRICT ptr0;
- const orc_int8 *ORC_RESTRICT ptr4;
- orc_int8 var32;
-
- ptr0 = (orc_int8 *) ex->arrays[0];
- ptr4 = (orc_int8 *) ex->arrays[4];
-
-
- for (i = 0; i < n; i++) {
- /* 0: ldreslinb */
- {
- int tmp = ex->params[24] + i * ex->params[25];
- var32 =
- ((orc_uint8) ptr4[tmp >> 16] * (256 - ((tmp >> 8) & 0xff)) +
- (orc_uint8) ptr4[(tmp >> 16) + 1] * ((tmp >> 8) & 0xff)) >> 8;
- }
- /* 1: storeb */
- ptr0[i] = var32;
- }
-
-}
-
-void
-cogorc_resample_horiz_2tap (orc_uint8 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- p = orc_program_new ();
- orc_program_set_name (p, "cogorc_resample_horiz_2tap");
- orc_program_set_backup_function (p, _backup_cogorc_resample_horiz_2tap);
- orc_program_add_destination (p, 1, "d1");
- orc_program_add_source (p, 1, "s1");
- orc_program_add_parameter (p, 4, "p1");
- orc_program_add_parameter (p, 4, "p2");
-
- orc_program_append_2 (p, "ldreslinb", 0, ORC_VAR_D1, ORC_VAR_S1,
- ORC_VAR_P1, ORC_VAR_P2);
-
- orc_program_compile (p);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- ex->n = n;
- ex->arrays[ORC_VAR_D1] = d1;
- ex->arrays[ORC_VAR_S1] = (void *) s1;
- ex->params[ORC_VAR_P1] = p1;
- ex->params[ORC_VAR_P2] = p2;
-
- func = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_I420_UYVY */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_I420_UYVY (orc_uint32 * ORC_RESTRICT d1,
- orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1,
- const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1,
- orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1,
- const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- const orc_uint8 * ORC_RESTRICT s4, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_I420_YUY2 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_I420_YUY2 (orc_uint32 * ORC_RESTRICT d1,
- orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1,
- const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1,
- orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1,
- const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- const orc_uint8 * ORC_RESTRICT s4, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_I420_AYUV */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_I420_AYUV (orc_uint32 * ORC_RESTRICT d1,
- orc_uint32 * ORC_RESTRICT d2, const orc_uint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1,
- orc_uint32 * ORC_RESTRICT d2, const orc_uint8 * ORC_RESTRICT s1,
- const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3,
- const orc_uint8 * ORC_RESTRICT s4, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_YUY2_I420 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_YUY2_I420 (orc_uint16 * ORC_RESTRICT d1,
- orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3,
- orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1,
- const orc_uint32 * 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 (orc_uint16 * ORC_RESTRICT d1,
- orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3,
- orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1,
- const orc_uint32 * ORC_RESTRICT s2, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_UYVY_YUY2 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_UYVY_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_planar_chroma_420_422 */
-#ifdef DISABLE_ORC
-void
-cogorc_planar_chroma_420_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride,
- const orc_uint8 * 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 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_planar_chroma_420_444 */
-#ifdef DISABLE_ORC
-void
-cogorc_planar_chroma_420_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride,
- const orc_uint8 * 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 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_planar_chroma_422_444 */
-#ifdef DISABLE_ORC
-void
-cogorc_planar_chroma_422_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * 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 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_planar_chroma_444_422 */
-#ifdef DISABLE_ORC
-void
-cogorc_planar_chroma_444_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * 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 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_planar_chroma_444_420 */
-#ifdef DISABLE_ORC
-void
-cogorc_planar_chroma_444_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint16 * 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 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint16 * ORC_RESTRICT s2, int s2_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_planar_chroma_422_420 */
-#ifdef DISABLE_ORC
-void
-cogorc_planar_chroma_422_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * 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 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_YUY2_AYUV */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_YUY2_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * 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 (orc_uint64 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_UYVY_AYUV */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_UYVY_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * 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 (orc_uint64 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_YUY2_Y42B */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_YUY2_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * 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 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_UYVY_Y42B */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_UYVY_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * 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 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_YUY2_Y444 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_YUY2_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * 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 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_UYVY_Y444 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_UYVY_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * 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 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_UYVY_I420 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_UYVY_I420 (orc_uint16 * ORC_RESTRICT d1,
- orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3,
- orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1,
- const orc_uint32 * 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 (orc_uint16 * ORC_RESTRICT d1,
- orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3,
- orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1,
- const orc_uint32 * ORC_RESTRICT s2, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_AYUV_I420 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_AYUV_I420 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, orc_uint8 * ORC_RESTRICT d4, int d4_stride,
- const orc_uint64 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint64 * 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 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, orc_uint8 * ORC_RESTRICT d4, int d4_stride,
- const orc_uint64 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint64 * ORC_RESTRICT s2, int s2_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_AYUV_YUY2 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_AYUV_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint64 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_AYUV_UYVY */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_AYUV_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint64 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_AYUV_Y42B */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_AYUV_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint64 * 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 (orc_uint16 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n,
- int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_AYUV_Y444 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_AYUV_Y444 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * 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 (orc_uint8 * ORC_RESTRICT d1, int d1_stride,
- orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3,
- int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n,
- int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_Y42B_YUY2 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_Y42B_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_Y42B_UYVY */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_Y42B_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_Y42B_AYUV */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_Y42B_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * 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 (orc_uint64 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_Y444_YUY2 */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_Y444_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint16 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint16 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint16 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_Y444_UYVY */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_Y444_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint16 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint16 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint16 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint16 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_Y444_AYUV */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_Y444_AYUV (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint8 * ORC_RESTRICT s1, int s1_stride,
- const orc_uint8 * ORC_RESTRICT s2, int s2_stride,
- const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_AYUV_ARGB */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_AYUV_ARGB (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_AYUV_BGRA */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_AYUV_BGRA (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_AYUV_ABGR */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_AYUV_ABGR (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_AYUV_RGBA */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_AYUV_RGBA (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * 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 (orc_uint32 * ORC_RESTRICT d1, int d1_stride,
- const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_I420_BGRA */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_I420_BGRA (orc_uint32 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
-
-
-/* cogorc_convert_I420_BGRA_avg */
-#ifdef DISABLE_ORC
-void
-cogorc_convert_I420_BGRA_avg (orc_uint32 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4,
- const orc_uint8 * 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 (orc_uint32 * ORC_RESTRICT d1,
- const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
- const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4,
- const orc_uint8 * ORC_RESTRICT s5, int n)
-{
- OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
- static OrcCode *c = 0;
- void (*func) (OrcExecutor *);
-
- if (!p_inited) {
- orc_once_mutex_lock ();
- if (!p_inited) {
- OrcProgram *p;
-
- 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);
- c = orc_program_take_code (p);
- orc_program_free (p);
- }
- p_inited = TRUE;
- orc_once_mutex_unlock ();
- }
- ex->arrays[ORC_VAR_A2] = c;
- ex->program = 0;
-
- 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 = c->exec;
- func (ex);
-}
-#endif
diff --git a/ext/cog/gstcogorc-dist.h b/ext/cog/gstcogorc-dist.h
deleted file mode 100644
index e7bac246e..000000000
--- a/ext/cog/gstcogorc-dist.h
+++ /dev/null
@@ -1,150 +0,0 @@
-
-/* autogenerated from gstcogorc.orc */
-
-#ifndef _GSTCOGORC_H_
-#define _GSTCOGORC_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 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_downsample_horiz_cosite_1tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, int n);
-void cogorc_downsample_horiz_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, int n);
-void cogorc_downsample_420_jpeg (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, int n);
-void cogorc_downsample_vert_halfsite_2tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n);
-void cogorc_downsample_vert_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n);
-void cogorc_downsample_vert_halfsite_4tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n);
-void cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, int n);
-void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n);
-void cogorc_upsample_vert_avgub (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n);
-void orc_unpack_yuyv_y (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, int n);
-void orc_unpack_yuyv_u (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n);
-void orc_unpack_yuyv_v (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n);
-void orc_pack_yuyv (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n);
-void orc_unpack_uyvy_y (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, int n);
-void orc_unpack_uyvy_u (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n);
-void orc_unpack_uyvy_v (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n);
-void orc_pack_uyvy (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n);
-void orc_addc_convert_u8_s16 (orc_uint8 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1, int n);
-void orc_subc_convert_s16_u8 (gint16 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, int n);
-void orc_splat_u8_ns (orc_uint8 * ORC_RESTRICT d1, int p1, int n);
-void orc_splat_s16_ns (gint16 * ORC_RESTRICT d1, int p1, 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 orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int p1, int n);
-void orc_pack_x123 (guint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int p1, int n);
-void cogorc_combine2_u8 (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p1, int p2, int n);
-void cogorc_combine4_u8 (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int p1, int p2, int p3, int p4, int n);
-void cogorc_unpack_axyz_0 (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n);
-void cogorc_unpack_axyz_1 (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n);
-void cogorc_unpack_axyz_2 (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n);
-void cogorc_unpack_axyz_3 (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n);
-void cogorc_resample_horiz_1tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n);
-void cogorc_resample_horiz_2tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n);
-void cogorc_convert_I420_UYVY (orc_uint32 * ORC_RESTRICT d1, orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n);
-void cogorc_convert_I420_YUY2 (orc_uint32 * ORC_RESTRICT d1, orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n);
-void cogorc_convert_I420_AYUV (orc_uint32 * ORC_RESTRICT d1, orc_uint32 * ORC_RESTRICT d2, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n);
-void cogorc_convert_YUY2_I420 (orc_uint16 * ORC_RESTRICT d1, orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, const orc_uint32 * ORC_RESTRICT s2, int n);
-void cogorc_convert_UYVY_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_420_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_420_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint16 * ORC_RESTRICT d2, int d2_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_422_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_444_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_planar_chroma_444_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint16 * ORC_RESTRICT s2, int s2_stride, int n, int m);
-void cogorc_planar_chroma_422_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
-void cogorc_convert_YUY2_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_UYVY_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_YUY2_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_UYVY_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_YUY2_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_UYVY_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_UYVY_I420 (orc_uint16 * ORC_RESTRICT d1, orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, const orc_uint32 * ORC_RESTRICT s2, int n);
-void cogorc_convert_AYUV_I420 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, orc_uint8 * ORC_RESTRICT d4, int d4_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, const orc_uint64 * ORC_RESTRICT s2, int s2_stride, int n, int m);
-void cogorc_convert_AYUV_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_Y444 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_Y42B_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y42B_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y42B_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y444_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint16 * ORC_RESTRICT s2, int s2_stride, const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y444_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint16 * ORC_RESTRICT s2, int s2_stride, const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_Y444_AYUV (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
-void cogorc_convert_AYUV_ARGB (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_BGRA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_ABGR (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_AYUV_RGBA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void cogorc_convert_I420_BGRA (orc_uint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n);
-void cogorc_convert_I420_BGRA_avg (orc_uint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, const orc_uint8 * ORC_RESTRICT s5, int n);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/ext/cog/gstcogscale.c b/ext/cog/gstcogscale.c
deleted file mode 100644
index 459f892b7..000000000
--- a/ext/cog/gstcogscale.c
+++ /dev/null
@@ -1,653 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) 2005 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-videoscale
- * @see_also: videorate, videoconvert
- *
- * <refsect2>
- * <para>
- * This element resizes video frames. By default the element will try to
- * negotiate to the same size on the source and sinkpad so that no scaling
- * is needed. It is therefore safe to insert this element in a pipeline to
- * get more robust behaviour without any cost if no scaling is needed.
- * </para>
- * <para>
- * This element supports a wide range of color spaces including various YUV and
- * RGB formats and is therefore generally able to operate anywhere in a
- * pipeline.
- * </para>
- * <title>Example pipelines</title>
- * <para>
- * <programlisting>
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoconvert ! videoscale ! ximagesink
- * </programlisting>
- * Decode an Ogg/Theora and display the video using ximagesink. Since
- * ximagesink cannot perform scaling, the video scaling will be performed by
- * videoscale when you resize the video window.
- * To create the test Ogg/Theora file refer to the documentation of theoraenc.
- * </para>
- * <para>
- * <programlisting>
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoscale ! video/x-raw-yuv, width=50 ! xvimagesink
- * </programlisting>
- * Decode an Ogg/Theora and display the video using xvimagesink with a width of
- * 50.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2006-03-02 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <gst/base/gstbasetransform.h>
-#include <cog/cog.h>
-#include <cog/cogvirtframe.h>
-#include "gstcogutils.h"
-
-GST_DEBUG_CATEGORY_STATIC (cog_scale_debug);
-#define GST_CAT_DEFAULT cog_scale_debug
-
-#define GST_TYPE_COG_SCALE \
- (gst_cog_scale_get_type())
-#define GST_COG_SCALE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COG_SCALE,GstCogScale))
-#define GST_COG_SCALE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COG_SCALE,GstCogScaleClass))
-#define GST_IS_COG_SCALE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COG_SCALE))
-#define GST_IS_COG_SCALE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COG_SCALE))
-
-typedef struct _GstCogScale GstCogScale;
-typedef struct _GstCogScaleClass GstCogScaleClass;
-
-/**
- * GstCogScale:
- *
- * Opaque data structure
- */
-struct _GstCogScale
-{
- GstBaseTransform element;
-
- int quality;
-
- /* negotiated stuff */
- GstVideoFormat format;
- guint src_size;
- guint dest_size;
- gint to_width;
- gint to_height;
- gint from_width;
- gint from_height;
-
- /*< private > */
-};
-
-struct _GstCogScaleClass
-{
- GstBaseTransformClass parent_class;
-};
-
-GType gst_cog_scale_get_type (void);
-
-#define DEFAULT_QUALITY 5
-
-enum
-{
- PROP_0,
- PROP_QUALITY
-};
-
-/* can't handle width/height of 1 yet, since we divide a lot by (n-1) */
-#undef GST_VIDEO_SIZE_RANGE
-#define GST_VIDEO_SIZE_RANGE "(int) [ 2, MAX ]"
-
-#define TEMPLATE_CAPS \
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, UYVY, AYUV, Y42B }") ";" \
- GST_VIDEO_CAPS_ARGB)
-
-static GstStaticPadTemplate gst_cog_scale_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- TEMPLATE_CAPS);
-
-static GstStaticPadTemplate gst_cog_scale_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- TEMPLATE_CAPS);
-
-static void gst_cog_scale_base_init (gpointer g_class);
-static void gst_cog_scale_class_init (GstCogScaleClass * klass);
-static void gst_cog_scale_init (GstCogScale * videoscale);
-static void gst_cog_scale_finalize (GstCogScale * videoscale);
-static gboolean gst_cog_scale_src_event (GstBaseTransform * trans,
- GstEvent * event);
-
-/* base transform vmethods */
-static GstCaps *gst_cog_scale_transform_caps (GstBaseTransform * trans,
- GstPadDirection direction, GstCaps * caps);
-static gboolean gst_cog_scale_set_caps (GstBaseTransform * trans,
- GstCaps * in, GstCaps * out);
-static gboolean gst_cog_scale_get_unit_size (GstBaseTransform * trans,
- GstCaps * caps, guint * size);
-static GstFlowReturn gst_cog_scale_transform (GstBaseTransform * trans,
- GstBuffer * in, GstBuffer * out);
-static void gst_cog_scale_fixate_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
-
-static void gst_cog_scale_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_cog_scale_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstElementClass *parent_class = NULL;
-
-
-GType
-gst_cog_scale_get_type (void)
-{
- static GType cog_scale_type = 0;
-
- if (!cog_scale_type) {
- static const GTypeInfo cog_scale_info = {
- sizeof (GstCogScaleClass),
- gst_cog_scale_base_init,
- NULL,
- (GClassInitFunc) gst_cog_scale_class_init,
- NULL,
- NULL,
- sizeof (GstCogScale),
- 0,
- (GInstanceInitFunc) gst_cog_scale_init,
- };
-
- cog_scale_type =
- g_type_register_static (GST_TYPE_BASE_TRANSFORM, "GstCogScale",
- &cog_scale_info, 0);
-
- GST_DEBUG_CATEGORY_INIT (cog_scale_debug, "cogscale", 0, "Cog scale");
- }
- return cog_scale_type;
-}
-
-static void
-gst_cog_scale_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_static_metadata (element_class, "Video scaler",
- "Filter/Effect/Video",
- "Resizes video", "Wim Taymans <wim.taymans@chello.be>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_cog_scale_src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_cog_scale_sink_template));
-}
-
-static void
-gst_cog_scale_class_init (GstCogScaleClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseTransformClass *trans_class;
-
- gobject_class = (GObjectClass *) klass;
- trans_class = (GstBaseTransformClass *) klass;
-
- gobject_class->finalize = (GObjectFinalizeFunc) gst_cog_scale_finalize;
- gobject_class->set_property = gst_cog_scale_set_property;
- gobject_class->get_property = gst_cog_scale_get_property;
-
- g_object_class_install_property (gobject_class, PROP_QUALITY,
- g_param_spec_int ("quality", "quality", "Scaling Quality",
- 0, 10, DEFAULT_QUALITY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- trans_class->transform_caps =
- GST_DEBUG_FUNCPTR (gst_cog_scale_transform_caps);
- trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_cog_scale_set_caps);
- trans_class->get_unit_size = GST_DEBUG_FUNCPTR (gst_cog_scale_get_unit_size);
- trans_class->transform = GST_DEBUG_FUNCPTR (gst_cog_scale_transform);
- trans_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_cog_scale_fixate_caps);
- trans_class->src_event = GST_DEBUG_FUNCPTR (gst_cog_scale_src_event);
-
- trans_class->passthrough_on_same_caps = TRUE;
-
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_cog_scale_init (GstCogScale * videoscale)
-{
- gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (videoscale), TRUE);
- videoscale->quality = DEFAULT_QUALITY;
-}
-
-static void
-gst_cog_scale_finalize (GstCogScale * videoscale)
-{
- G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT (videoscale));
-}
-
-static void
-gst_cog_scale_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstCogScale *vscale = GST_COG_SCALE (object);
-
- switch (prop_id) {
- case PROP_QUALITY:
- GST_OBJECT_LOCK (vscale);
- vscale->quality = g_value_get_int (value);
- GST_OBJECT_UNLOCK (vscale);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_cog_scale_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstCogScale *vscale = GST_COG_SCALE (object);
-
- switch (prop_id) {
- case PROP_QUALITY:
- GST_OBJECT_LOCK (vscale);
- g_value_set_int (value, vscale->quality);
- GST_OBJECT_UNLOCK (vscale);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstCaps *
-gst_cog_scale_transform_caps (GstBaseTransform * trans,
- GstPadDirection direction, GstCaps * caps)
-{
- GstCaps *ret;
- GstStructure *structure;
- const GValue *par;
-
- /* this function is always called with a simple caps */
- g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL);
-
- structure = gst_caps_get_structure (caps, 0);
-
- ret = gst_caps_copy (caps);
- structure = gst_caps_get_structure (ret, 0);
-
- gst_structure_set (structure,
- "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-
- /* if pixel aspect ratio, make a range of it */
- if ((par = gst_structure_get_value (structure, "pixel-aspect-ratio"))) {
- GstCaps *copy;
- GstStructure *cstruct;
-
- /* copy input PAR first, this is the prefered PAR */
- gst_structure_set_value (structure, "pixel-aspect-ratio", par);
-
- /* then make a copy with a fraction range as a second choice */
- copy = gst_caps_copy (ret);
- cstruct = gst_caps_get_structure (copy, 0);
- gst_structure_set (cstruct,
- "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
-
- /* and append */
- gst_caps_append (ret, copy);
- }
-
- GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret);
-
- return ret;
-}
-
-static gboolean
-gst_cog_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
-{
- GstCogScale *videoscale;
- gboolean ret;
-
- videoscale = GST_COG_SCALE (trans);
-
- ret = gst_video_format_parse_caps (in, &videoscale->format,
- &videoscale->from_width, &videoscale->from_height);
- ret &= gst_video_format_parse_caps (out, NULL,
- &videoscale->to_width, &videoscale->to_height);
- if (!ret)
- goto done;
-
- videoscale->src_size = gst_video_format_get_size (videoscale->format,
- videoscale->from_width, videoscale->from_height);
- videoscale->dest_size = gst_video_format_get_size (videoscale->format,
- videoscale->to_width, videoscale->to_height);
-
- /* FIXME: par */
- GST_DEBUG_OBJECT (videoscale, "from=%dx%d, size %d -> to=%dx%d, size %d",
- videoscale->from_width, videoscale->from_height, videoscale->src_size,
- videoscale->to_width, videoscale->to_height, videoscale->dest_size);
-
-done:
- return ret;
-}
-
-static gboolean
-gst_cog_scale_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
- guint * size)
-{
- GstVideoFormat format;
- gint width, height;
-
- g_assert (size);
-
- if (!gst_video_format_parse_caps (caps, &format, &width, &height))
- return FALSE;
-
- *size = gst_video_format_get_size (format, width, height);
-
- return TRUE;
-}
-
-static void
-gst_cog_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
- GstCaps * caps, GstCaps * othercaps)
-{
- GstStructure *ins, *outs;
- const GValue *from_par, *to_par;
-
- g_return_if_fail (gst_caps_is_fixed (caps));
-
- GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT
- " based on caps %" GST_PTR_FORMAT, othercaps, caps);
-
- ins = gst_caps_get_structure (caps, 0);
- outs = gst_caps_get_structure (othercaps, 0);
-
- from_par = gst_structure_get_value (ins, "pixel-aspect-ratio");
- to_par = gst_structure_get_value (outs, "pixel-aspect-ratio");
-
- /* we have both PAR but they might not be fixated */
- if (from_par && to_par) {
- gint from_w, from_h, from_par_n, from_par_d, to_par_n, to_par_d;
- gint count = 0, w = 0, h = 0;
- guint num, den;
-
- /* from_par should be fixed */
- g_return_if_fail (gst_value_is_fixed (from_par));
-
- from_par_n = gst_value_get_fraction_numerator (from_par);
- from_par_d = gst_value_get_fraction_denominator (from_par);
-
- /* fixate the out PAR */
- if (!gst_value_is_fixed (to_par)) {
- GST_DEBUG_OBJECT (base, "fixating to_par to %dx%d", from_par_n,
- from_par_d);
- gst_structure_fixate_field_nearest_fraction (outs, "pixel-aspect-ratio",
- from_par_n, from_par_d);
- }
-
- to_par_n = gst_value_get_fraction_numerator (to_par);
- to_par_d = gst_value_get_fraction_denominator (to_par);
-
- /* if both width and height are already fixed, we can't do anything
- * about it anymore */
- if (gst_structure_get_int (outs, "width", &w))
- ++count;
- if (gst_structure_get_int (outs, "height", &h))
- ++count;
- if (count == 2) {
- GST_DEBUG_OBJECT (base, "dimensions already set to %dx%d, not fixating",
- w, h);
- return;
- }
-
- gst_structure_get_int (ins, "width", &from_w);
- gst_structure_get_int (ins, "height", &from_h);
-
- if (!gst_video_calculate_display_ratio (&num, &den, from_w, from_h,
- from_par_n, from_par_d, to_par_n, to_par_d)) {
- GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output scaled size - integer overflow"));
- return;
- }
-
- GST_DEBUG_OBJECT (base,
- "scaling input with %dx%d and PAR %d/%d to output PAR %d/%d",
- from_w, from_h, from_par_n, from_par_d, to_par_n, to_par_d);
- GST_DEBUG_OBJECT (base, "resulting output should respect ratio of %d/%d",
- num, den);
-
- /* now find a width x height that respects this display ratio.
- * prefer those that have one of w/h the same as the incoming video
- * using wd / hd = num / den */
-
- /* if one of the output width or height is fixed, we work from there */
- if (h) {
- GST_DEBUG_OBJECT (base, "height is fixed,scaling width");
- w = (guint) gst_util_uint64_scale_int (h, num, den);
- } else if (w) {
- GST_DEBUG_OBJECT (base, "width is fixed, scaling height");
- h = (guint) gst_util_uint64_scale_int (w, den, num);
- } else {
- /* none of width or height is fixed, figure out both of them based only on
- * the input width and height */
- /* check hd / den is an integer scale factor, and scale wd with the PAR */
- if (from_h % den == 0) {
- GST_DEBUG_OBJECT (base, "keeping video height");
- h = from_h;
- w = (guint) gst_util_uint64_scale_int (h, num, den);
- } else if (from_w % num == 0) {
- GST_DEBUG_OBJECT (base, "keeping video width");
- w = from_w;
- h = (guint) gst_util_uint64_scale_int (w, den, num);
- } else {
- GST_DEBUG_OBJECT (base, "approximating but keeping video height");
- h = from_h;
- w = (guint) gst_util_uint64_scale_int (h, num, den);
- }
- }
- GST_DEBUG_OBJECT (base, "scaling to %dx%d", w, h);
-
- /* now fixate */
- gst_structure_fixate_field_nearest_int (outs, "width", w);
- gst_structure_fixate_field_nearest_int (outs, "height", h);
- } else {
- gint width, height;
-
- if (gst_structure_get_int (ins, "width", &width)) {
- if (gst_structure_has_field (outs, "width")) {
- gst_structure_fixate_field_nearest_int (outs, "width", width);
- }
- }
- if (gst_structure_get_int (ins, "height", &height)) {
- if (gst_structure_has_field (outs, "height")) {
- gst_structure_fixate_field_nearest_int (outs, "height", height);
- }
- }
- }
-
- GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
-}
-
-#if 0
-static gboolean
-gst_cog_scale_prepare_image (gint format, GstBuffer * buf,
- VSImage * img, VSImage * img_u, VSImage * img_v)
-{
- gboolean res = TRUE;
-
- img->pixels = GST_BUFFER_DATA (buf);
-
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- img_u->pixels = img->pixels + GST_ROUND_UP_2 (img->height) * img->stride;
- img_u->height = GST_ROUND_UP_2 (img->height) / 2;
- img_u->width = GST_ROUND_UP_2 (img->width) / 2;
- img_u->stride = GST_ROUND_UP_4 (img_u->width);
- memcpy (img_v, img_u, sizeof (*img_v));
- img_v->pixels = img_u->pixels + img_u->height * img_u->stride;
- break;
- default:
- break;
- }
- return res;
-}
-#endif
-
-static GstFlowReturn
-gst_cog_scale_transform (GstBaseTransform * trans, GstBuffer * in,
- GstBuffer * out)
-{
- GstCogScale *videoscale;
- GstFlowReturn ret = GST_FLOW_OK;
- CogFrame *outframe;
- CogFrame *frame;
- int w, h;
- int quality;
- static const int n_vert_taps[11] = { 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4 };
- static const int n_horiz_taps[11] = { 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4 };
-
- videoscale = GST_COG_SCALE (trans);
-
- GST_OBJECT_LOCK (videoscale);
- quality = videoscale->quality;
- GST_OBJECT_UNLOCK (videoscale);
-
- frame = gst_cog_buffer_wrap (gst_buffer_ref (in), videoscale->format,
- videoscale->from_width, videoscale->from_height);
- outframe = gst_cog_buffer_wrap (gst_buffer_ref (out), videoscale->format,
- videoscale->to_width, videoscale->to_height);
-
- frame = cog_virt_frame_new_unpack (frame);
-
- w = videoscale->from_width;
- h = videoscale->from_height;
- while (w >= 2 * videoscale->to_width || h >= 2 * videoscale->to_height) {
- if (w >= 2 * videoscale->to_width) {
- frame = cog_virt_frame_new_horiz_downsample (frame, 3);
- w /= 2;
- }
- if (h >= 2 * videoscale->to_height) {
- frame = cog_virt_frame_new_vert_downsample (frame, 4);
- h /= 2;
- }
- }
- if (w != videoscale->to_width) {
- frame = cog_virt_frame_new_horiz_resample (frame, videoscale->to_width,
- n_horiz_taps[quality]);
- }
- if (h != videoscale->to_height) {
- frame = cog_virt_frame_new_vert_resample (frame, videoscale->to_height,
- n_vert_taps[quality]);
- }
-
- switch (videoscale->format) {
- case GST_VIDEO_FORMAT_YUY2:
- frame = cog_virt_frame_new_pack_YUY2 (frame);
- break;
- case GST_VIDEO_FORMAT_UYVY:
- frame = cog_virt_frame_new_pack_UYVY (frame);
- break;
- default:
- break;
- }
-
- cog_virt_frame_render (frame, outframe);
- cog_frame_unref (frame);
- cog_frame_unref (outframe);
-
- GST_LOG_OBJECT (videoscale, "pushing buffer of %d bytes",
- GST_BUFFER_SIZE (out));
-
- return ret;
-
- /* ERRORS */
-#if 0
-unsupported:
- {
- GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
- ("Unsupported format %d for scaling method %d",
- videoscale->format, method));
- return GST_FLOW_ERROR;
- }
-unknown_mode:
- {
- GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
- ("Unknown scaling method %d", videoscale->method));
- return GST_FLOW_ERROR;
- }
-#endif
-}
-
-static gboolean
-gst_cog_scale_src_event (GstBaseTransform * trans, GstEvent * event)
-{
- GstCogScale *videoscale;
- gboolean ret;
- double a;
- GstStructure *structure;
-
- videoscale = GST_COG_SCALE (trans);
-
- GST_DEBUG_OBJECT (videoscale, "handling %s event",
- GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NAVIGATION:
- event =
- GST_EVENT (gst_mini_object_make_writable (GST_MINI_OBJECT (event)));
-
- structure = (GstStructure *) gst_event_get_structure (event);
- if (gst_structure_get_double (structure, "pointer_x", &a)) {
- gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
- a * videoscale->from_width / videoscale->to_width, NULL);
- }
- if (gst_structure_get_double (structure, "pointer_y", &a)) {
- gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
- a * videoscale->from_height / videoscale->to_height, NULL);
- }
- break;
- case GST_EVENT_QOS:
- break;
- default:
- break;
- }
-
- ret = GST_BASE_TRANSFORM_CLASS (parent_class)->src_event (trans, event);
-
- return ret;
-}
diff --git a/ext/cog/gstcogutils.c b/ext/cog/gstcogutils.c
deleted file mode 100644
index 2d6174345..000000000
--- a/ext/cog/gstcogutils.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Cog
- * Copyright (C) 2008 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstcogutils.h"
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <cog/cog.h>
-#include <cog/cogvirtframe.h>
-#include <math.h>
-#include <string.h>
-
-GST_DEBUG_CATEGORY_EXTERN (cog_debug);
-#define GST_CAT_DEFAULT cog_debug
-
-
-
-
-static void
-gst_cog_frame_free (CogFrame * frame, void *priv)
-{
- gst_buffer_unref (GST_BUFFER (priv));
-}
-
-CogFrame *
-gst_cog_buffer_wrap (GstBuffer * buf, GstVideoFormat format, int width,
- int height)
-{
- CogFrame *frame;
- int size;
-
- size = gst_video_format_get_size (format, width, height);
- if (GST_BUFFER_SIZE (buf) != size) {
- GST_ERROR ("size incorrect, expected %d, got %d", size,
- GST_BUFFER_SIZE (buf));
- }
-
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- frame =
- cog_frame_new_from_data_I420 (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_YV12:
- frame =
- cog_frame_new_from_data_YV12 (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_YUY2:
- frame =
- cog_frame_new_from_data_YUY2 (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_UYVY:
- frame =
- cog_frame_new_from_data_UYVY (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_AYUV:
- frame =
- cog_frame_new_from_data_AYUV (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_Y42B:
- frame =
- cog_frame_new_from_data_Y42B (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_Y444:
- frame =
- cog_frame_new_from_data_Y444 (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_v210:
- frame =
- cog_frame_new_from_data_v210 (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_v216:
- frame =
- cog_frame_new_from_data_v216 (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_RGBx:
- frame =
- cog_frame_new_from_data_RGBx (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_BGRx:
- frame =
- cog_frame_new_from_data_BGRx (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_xRGB:
- frame =
- cog_frame_new_from_data_xRGB (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_xBGR:
- frame =
- cog_frame_new_from_data_xBGR (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_RGBA:
- frame =
- cog_frame_new_from_data_RGBA (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_BGRA:
- frame =
- cog_frame_new_from_data_BGRA (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_ARGB:
- frame =
- cog_frame_new_from_data_ARGB (GST_BUFFER_DATA (buf), width, height);
- break;
- case GST_VIDEO_FORMAT_ABGR:
- frame =
- cog_frame_new_from_data_ABGR (GST_BUFFER_DATA (buf), width, height);
- break;
- default:
- g_assert_not_reached ();
- return NULL;
- }
- cog_frame_set_free_callback (frame, gst_cog_frame_free, buf);
-
- return frame;
-}
-
-#if 0
-#ifdef GST_BUFFER_FREE_FUNC
-static void
-cog_buf_free_func (gpointer priv)
-{
- CogBuffer *buffer = (CogBuffer *) priv;
-
- cog_buffer_unref (buffer);
-}
-#endif
-
-/* takes the reference */
-GstBuffer *
-gst_cog_wrap_cog_buffer (CogBuffer * buffer)
-{
- GstBuffer *gstbuf;
-
-#ifdef GST_BUFFER_FREE_FUNC
- gstbuf = gst_buffer_new ();
- GST_BUFFER_DATA (gstbuf) = buffer->data;
- GST_BUFFER_SIZE (gstbuf) = buffer->length;
- GST_BUFFER_MALLOCDATA (gstbuf) = (void *) buffer;
- GST_BUFFER_FREE_FUNC (gstbuf) = cog_buf_free_func;
-#else
- gstbuf = gst_buffer_new_and_alloc (buffer->length);
- memcpy (GST_BUFFER_DATA (gstbuf), buffer->data, buffer->length);
-#endif
-
- return gstbuf;
-}
-
-static void
-gst_cog_buffer_free (CogBuffer * buffer, void *priv)
-{
- gst_buffer_unref (GST_BUFFER (priv));
-}
-
-CogBuffer *
-gst_cog_wrap_gst_buffer (GstBuffer * buffer)
-{
- CogBuffer *cogbuf;
-
- cogbuf = cog_buffer_new_with_data (GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
- cogbuf->free = gst_cog_buffer_free;
- cogbuf->priv = buffer;
-
- return cogbuf;
-}
-#endif
diff --git a/ext/cog/gstcogutils.h b/ext/cog/gstcogutils.h
deleted file mode 100644
index 51ee4b26a..000000000
--- a/ext/cog/gstcogutils.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Schrodinger
- * Copyright (C) 2008 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_COG_UTILS_H_
-#define _GST_COG_UTILS_H_
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <cog/cog.h>
-#include <cog/cogframe.h>
-
-CogFrame *
-gst_cog_buffer_wrap (GstBuffer *buf, GstVideoFormat format, int width,
- int height);
-#if 0
-GstBuffer * gst_cog_wrap_cog_buffer (CogBuffer *buffer);
-CogBuffer * gst_cog_wrap_gst_buffer (GstBuffer *buffer);
-#endif
-
-#endif
-