extractcolor: add orc functions

This commit is contained in:
Joshua M. Doe 2015-06-29 14:46:36 -04:00
parent 723eea207e
commit 80176d2308
6 changed files with 898 additions and 12 deletions

View File

@ -19,6 +19,9 @@ macro_log_feature(GLIB2_FOUND "GLib" "Required to build gst-plugins-vision" "htt
find_package(GObject REQUIRED)
macro_log_feature(GOBJECT_FOUND "GObject" "Required to build gst-plugins-vision" "http://www.gtk.org/" TRUE)
find_package(Orc REQUIRED)
macro_log_feature(ORC_FOUND "Orc" "Required library to improve performance" "http://code.entropywave.com/orc/" TRUE)
find_package(NIIMAQ)
macro_log_feature(NIIMAQ_FOUND "NI-IMAQ" "Required to build National Instruments IMAQ source element" "http://www.ni.com/" FALSE)

View File

@ -1,14 +1,16 @@
add_definitions (-DHAVE_CONFIG_H)
set (SOURCES
gstextractcolor.c)
gstextractcolor.c
gstextractcolororc-dist.c)
set (HEADERS
gstextractcolor.h)
include_directories (AFTER
${GSTREAMER_BASE_INCLUDE_DIR}
${GSTREAMER_VIDEO_INCLUDE_DIR})
${GSTREAMER_VIDEO_INCLUDE_DIR}
${ORC_INCLUDE_DIR})
add_library (libgstextractcolor MODULE
${SOURCES}
@ -19,7 +21,8 @@ target_link_libraries (libgstextractcolor
${GOBJECT_LIBRARIES}
${GSTREAMER_LIBRARY}
${GSTREAMER_BASE_LIBRARY}
${GSTREAMER_VIDEO_LIBRARY})
${GSTREAMER_VIDEO_LIBRARY}
${ORC_LIBRARIES})
install (TARGETS libgstextractcolor
LIBRARY DESTINATION lib/gstreamer-1.0)

View File

@ -42,6 +42,8 @@
#include <gst/video/video.h>
#include "gstextractcolororc-dist.h"
/* GstExtractColor signals and args */
enum
{
@ -338,18 +340,54 @@ gst_extract_color_transform_frame (GstVideoFilter * filter,
GstVideoFrame * in_frame, GstVideoFrame * out_frame)
{
GstExtractColor *filt = GST_EXTRACT_COLOR (filter);
GstClockTime start =
gst_clock_get_time (gst_element_get_clock (GST_ELEMENT (filt)));
GTimer *timer = NULL;
guint comp = filt->component;
GST_LOG_OBJECT (filt, "Performing non-inplace transform");
/* TODO: create orc functions for these to speed them up */
#if 0
timer = g_timer_new ();
#endif
if (GST_VIDEO_FRAME_COMP_DEPTH (in_frame, comp) == 8) {
guint8 *src, *dst;
src = GST_VIDEO_FRAME_PLANE_DATA (in_frame, 0);
dst = GST_VIDEO_FRAME_PLANE_DATA (out_frame, 0);
switch (GST_VIDEO_FRAME_COMP_OFFSET (in_frame, comp)) {
case 0:
extractcolor_orc_copy32_0 (dst, GST_VIDEO_FRAME_PLANE_STRIDE (out_frame,
0), src, GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 0),
GST_VIDEO_FRAME_WIDTH (in_frame),
GST_VIDEO_FRAME_HEIGHT (out_frame));
break;
case 1:
extractcolor_orc_copy32_1 (dst, GST_VIDEO_FRAME_PLANE_STRIDE (out_frame,
0), src, GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 0),
GST_VIDEO_FRAME_WIDTH (in_frame),
GST_VIDEO_FRAME_HEIGHT (out_frame));
break;
case 2:
extractcolor_orc_copy32_2 (dst, GST_VIDEO_FRAME_PLANE_STRIDE (out_frame,
0), src, GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 0),
GST_VIDEO_FRAME_WIDTH (in_frame),
GST_VIDEO_FRAME_HEIGHT (out_frame));
break;
case 3:
extractcolor_orc_copy32_3 (dst, GST_VIDEO_FRAME_PLANE_STRIDE (out_frame,
0), src, GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 0),
GST_VIDEO_FRAME_WIDTH (in_frame),
GST_VIDEO_FRAME_HEIGHT (out_frame));
break;
default:
g_assert_not_reached ();
}
#if 0
gint x, y;
guint8 *src = GST_VIDEO_FRAME_COMP_DATA (in_frame, comp);
guint8 *dst = GST_VIDEO_FRAME_COMP_DATA (out_frame, 0);
const guint pstride = GST_VIDEO_FRAME_COMP_PSTRIDE (in_frame, comp);
src = GST_VIDEO_FRAME_COMP_DATA (in_frame, comp);
dst = GST_VIDEO_FRAME_COMP_DATA (out_frame, 0);
for (y = 0; y < GST_VIDEO_FRAME_COMP_HEIGHT (in_frame, comp); y++) {
for (x = 0; x < GST_VIDEO_FRAME_COMP_WIDTH (in_frame, comp); x++) {
dst[x] = src[x * pstride];
@ -357,6 +395,7 @@ gst_extract_color_transform_frame (GstVideoFilter * filter,
src += GST_VIDEO_FRAME_COMP_STRIDE (in_frame, comp);
dst += GST_VIDEO_FRAME_COMP_STRIDE (out_frame, 0);
}
#endif
} else {
gint x, y;
guint16 *src = (guint16 *) GST_VIDEO_FRAME_COMP_DATA (in_frame, comp);
@ -371,10 +410,11 @@ gst_extract_color_transform_frame (GstVideoFilter * filter,
}
}
GST_LOG_OBJECT (filt, "Processing took %" G_GINT64_FORMAT "ms",
GST_TIME_AS_MSECONDS (GST_CLOCK_DIFF (start,
gst_clock_get_time (gst_element_get_clock (GST_ELEMENT
(filt))))));
#if 0
GST_LOG_OBJECT (filt, "Processing took %.3f ms", g_timer_elapsed (timer,
NULL) * 1000);
g_timer_destroy (timer);
#endif
return GST_FLOW_OK;
}

View File

@ -0,0 +1,677 @@
#include "gstextractcolororc-dist.h"
/* autogenerated from gstextractcolororc.orc */
#ifdef HAVE_CONFIG_H
#include "config.h"
#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
#ifndef ORC_INTERNAL
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
#define ORC_INTERNAL __attribute__((visibility("hidden")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define ORC_INTERNAL __hidden
#elif defined (__GNUC__)
#define ORC_INTERNAL __attribute__((visibility("hidden")))
#else
#define ORC_INTERNAL
#endif
#endif
#ifndef DISABLE_ORC
#include <orc/orc.h>
#endif
void extractcolor_orc_copy32_0 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void extractcolor_orc_copy32_1 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void extractcolor_orc_copy32_2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void extractcolor_orc_copy32_3 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
/* 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)&0xffU)<<8) | (((x)&0xff00U)>>8))
#define ORC_SWAP_L(x) ((((x)&0xffU)<<24) | (((x)&0xff00U)<<8) | (((x)&0xff0000U)>>8) | (((x)&0xff000000U)>>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 */
/* extractcolor_orc_copy32_0 */
#ifdef DISABLE_ORC
void
extractcolor_orc_copy32_0 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m){
int i;
int j;
orc_int8 * ORC_RESTRICT ptr0;
const orc_union32 * ORC_RESTRICT ptr4;
orc_union32 var33;
orc_int8 var34;
orc_union16 var35;
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 */
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_extractcolor_orc_copy32_0 (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_union32 * ORC_RESTRICT ptr4;
orc_union32 var33;
orc_int8 var34;
orc_union16 var35;
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 */
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
extractcolor_orc_copy32_0 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * 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;
#if 1
static const orc_uint8 bc[] = {
1, 7, 9, 25, 101, 120, 116, 114, 97, 99, 116, 99, 111, 108, 111, 114,
95, 111, 114, 99, 95, 99, 111, 112, 121, 51, 50, 95, 48, 11, 1, 1,
12, 4, 4, 20, 2, 190, 32, 4, 188, 0, 32, 2, 0,
};
p = orc_program_new_from_static_bytecode (bc);
orc_program_set_backup_function (p, _backup_extractcolor_orc_copy32_0);
#else
p = orc_program_new ();
orc_program_set_2d (p);
orc_program_set_name (p, "extractcolor_orc_copy32_0");
orc_program_set_backup_function (p, _backup_extractcolor_orc_copy32_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);
#endif
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
/* extractcolor_orc_copy32_1 */
#ifdef DISABLE_ORC
void
extractcolor_orc_copy32_1 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m){
int i;
int j;
orc_int8 * ORC_RESTRICT ptr0;
const orc_union32 * ORC_RESTRICT ptr4;
orc_union32 var33;
orc_int8 var34;
orc_union16 var35;
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 */
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_extractcolor_orc_copy32_1 (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_union32 * ORC_RESTRICT ptr4;
orc_union32 var33;
orc_int8 var34;
orc_union16 var35;
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 */
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
extractcolor_orc_copy32_1 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * 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;
#if 1
static const orc_uint8 bc[] = {
1, 7, 9, 25, 101, 120, 116, 114, 97, 99, 116, 99, 111, 108, 111, 114,
95, 111, 114, 99, 95, 99, 111, 112, 121, 51, 50, 95, 49, 11, 1, 1,
12, 4, 4, 20, 2, 190, 32, 4, 189, 0, 32, 2, 0,
};
p = orc_program_new_from_static_bytecode (bc);
orc_program_set_backup_function (p, _backup_extractcolor_orc_copy32_1);
#else
p = orc_program_new ();
orc_program_set_2d (p);
orc_program_set_name (p, "extractcolor_orc_copy32_1");
orc_program_set_backup_function (p, _backup_extractcolor_orc_copy32_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);
#endif
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
/* extractcolor_orc_copy32_2 */
#ifdef DISABLE_ORC
void
extractcolor_orc_copy32_2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m){
int i;
int j;
orc_int8 * ORC_RESTRICT ptr0;
const orc_union32 * ORC_RESTRICT ptr4;
orc_union32 var33;
orc_int8 var34;
orc_union16 var35;
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 */
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_extractcolor_orc_copy32_2 (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_union32 * ORC_RESTRICT ptr4;
orc_union32 var33;
orc_int8 var34;
orc_union16 var35;
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 */
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
extractcolor_orc_copy32_2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * 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;
#if 1
static const orc_uint8 bc[] = {
1, 7, 9, 25, 101, 120, 116, 114, 97, 99, 116, 99, 111, 108, 111, 114,
95, 111, 114, 99, 95, 99, 111, 112, 121, 51, 50, 95, 50, 11, 1, 1,
12, 4, 4, 20, 2, 191, 32, 4, 188, 0, 32, 2, 0,
};
p = orc_program_new_from_static_bytecode (bc);
orc_program_set_backup_function (p, _backup_extractcolor_orc_copy32_2);
#else
p = orc_program_new ();
orc_program_set_2d (p);
orc_program_set_name (p, "extractcolor_orc_copy32_2");
orc_program_set_backup_function (p, _backup_extractcolor_orc_copy32_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);
#endif
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
/* extractcolor_orc_copy32_3 */
#ifdef DISABLE_ORC
void
extractcolor_orc_copy32_3 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m){
int i;
int j;
orc_int8 * ORC_RESTRICT ptr0;
const orc_union32 * ORC_RESTRICT ptr4;
orc_union32 var33;
orc_int8 var34;
orc_union16 var35;
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 */
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_extractcolor_orc_copy32_3 (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_union32 * ORC_RESTRICT ptr4;
orc_union32 var33;
orc_int8 var34;
orc_union16 var35;
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 */
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
extractcolor_orc_copy32_3 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * 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;
#if 1
static const orc_uint8 bc[] = {
1, 7, 9, 25, 101, 120, 116, 114, 97, 99, 116, 99, 111, 108, 111, 114,
95, 111, 114, 99, 95, 99, 111, 112, 121, 51, 50, 95, 51, 11, 1, 1,
12, 4, 4, 20, 2, 191, 32, 4, 189, 0, 32, 2, 0,
};
p = orc_program_new_from_static_bytecode (bc);
orc_program_set_backup_function (p, _backup_extractcolor_orc_copy32_3);
#else
p = orc_program_new ();
orc_program_set_2d (p);
orc_program_set_name (p, "extractcolor_orc_copy32_3");
orc_program_set_backup_function (p, _backup_extractcolor_orc_copy32_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);
#endif
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

View File

@ -0,0 +1,92 @@
#include <glib.h>
/* autogenerated from gstextractcolororc.orc */
#ifndef _OUT_H_
#define _OUT_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
#ifndef ORC_INTERNAL
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
#define ORC_INTERNAL __attribute__((visibility("hidden")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define ORC_INTERNAL __hidden
#elif defined (__GNUC__)
#define ORC_INTERNAL __attribute__((visibility("hidden")))
#else
#define ORC_INTERNAL
#endif
#endif
void extractcolor_orc_copy32_0 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void extractcolor_orc_copy32_1 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void extractcolor_orc_copy32_2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void extractcolor_orc_copy32_3 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,71 @@
.function extractcolor_orc_copy32_0
.flags 2d
.dest 1 d guint8
.source 4 s guint8
.temp 2 t
select0lw t, s
select0wb d, t
.function extractcolor_orc_copy32_1
.flags 2d
.dest 1 d guint8
.source 4 s guint8
.temp 2 t
select0lw t, s
select1wb d, t
.function extractcolor_orc_copy32_2
.flags 2d
.dest 1 d guint8
.source 4 s guint8
.temp 2 t
select1lw t, s
select0wb d, t
.function extractcolor_orc_copy32_3
.flags 2d
.dest 1 d guint8
.source 4 s guint8
.temp 2 t
select1lw t, s
select1wb d, t
.function extractcolor_orc_copy64_0
.flags 2d
.dest 2 d guint16
.source 8 s guint16
.temp 4 t
select0ql t, s
select0lw d, t
.function extractcolor_orc_copy64_1
.flags 2d
.dest 2 d guint16
.source 8 s guint16
.temp 4 t
select0ql t, s
select1lw d, t
.function extractcolor_orc_copy64_2
.flags 2d
.dest 2 d guint16
.source 8 s guint16
.temp 4 t
select1ql t, s
select0lw d, t
.function extractcolor_orc_copy64_3
.flags 2d
.dest 2 d guint16
.source 8 s guint16
.temp 4 t
select1ql t, s
select1lw d, t