mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
adder: Remove caching of the processing function
The compiler will generate a hashtable from the switch-case, and we need to call functions explicitely for the volume!=1.0 cases anyway.
This commit is contained in:
parent
a76ade2d78
commit
667b856cbc
5 changed files with 147 additions and 153 deletions
|
@ -398,34 +398,6 @@ gst_adder_setcaps (GstAdder * adder, GstPad * pad, GstCaps * caps)
|
||||||
if (!gst_audio_info_from_caps (&adder->info, caps))
|
if (!gst_audio_info_from_caps (&adder->info, caps))
|
||||||
goto invalid_format;
|
goto invalid_format;
|
||||||
|
|
||||||
switch (GST_AUDIO_INFO_FORMAT (&adder->info)) {
|
|
||||||
case GST_AUDIO_FORMAT_S8:
|
|
||||||
adder->func = (GstAdderFunction) adder_orc_add_int8;
|
|
||||||
break;
|
|
||||||
case GST_AUDIO_FORMAT_U8:
|
|
||||||
adder->func = (GstAdderFunction) adder_orc_add_uint8;
|
|
||||||
break;
|
|
||||||
case GST_AUDIO_FORMAT_S16:
|
|
||||||
adder->func = (GstAdderFunction) adder_orc_add_int16;
|
|
||||||
break;
|
|
||||||
case GST_AUDIO_FORMAT_U16:
|
|
||||||
adder->func = (GstAdderFunction) adder_orc_add_uint16;
|
|
||||||
break;
|
|
||||||
case GST_AUDIO_FORMAT_S32:
|
|
||||||
adder->func = (GstAdderFunction) adder_orc_add_int32;
|
|
||||||
break;
|
|
||||||
case GST_AUDIO_FORMAT_U32:
|
|
||||||
adder->func = (GstAdderFunction) adder_orc_add_uint32;
|
|
||||||
break;
|
|
||||||
case GST_AUDIO_FORMAT_F32:
|
|
||||||
adder->func = (GstAdderFunction) adder_orc_add_float32;
|
|
||||||
break;
|
|
||||||
case GST_AUDIO_FORMAT_F64:
|
|
||||||
adder->func = (GstAdderFunction) adder_orc_add_float64;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
goto invalid_format;
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -1007,7 +979,6 @@ gst_adder_init (GstAdder * adder)
|
||||||
adder->current_caps = NULL;
|
adder->current_caps = NULL;
|
||||||
gst_audio_info_init (&adder->info);
|
gst_audio_info_init (&adder->info);
|
||||||
adder->padcount = 0;
|
adder->padcount = 0;
|
||||||
adder->func = NULL;
|
|
||||||
|
|
||||||
adder->filter_caps = NULL;
|
adder->filter_caps = NULL;
|
||||||
|
|
||||||
|
@ -1207,7 +1178,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
|
||||||
adder = GST_ADDER (user_data);
|
adder = GST_ADDER (user_data);
|
||||||
|
|
||||||
/* this is fatal */
|
/* this is fatal */
|
||||||
if (G_UNLIKELY (adder->func == NULL))
|
if (G_UNLIKELY (adder->info.finfo->format == GST_AUDIO_FORMAT_UNKNOWN))
|
||||||
goto not_negotiated;
|
goto not_negotiated;
|
||||||
|
|
||||||
if (adder->flush_stop_pending == TRUE) {
|
if (adder->flush_stop_pending == TRUE) {
|
||||||
|
@ -1382,8 +1353,43 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
|
||||||
|
|
||||||
/* further buffers, need to add them */
|
/* further buffers, need to add them */
|
||||||
if (pad->volume == 1.0) {
|
if (pad->volume == 1.0) {
|
||||||
adder->func ((gpointer) outmap.data, (gpointer) inmap.data,
|
switch (adder->info.finfo->format) {
|
||||||
inmap.size / bps);
|
case GST_AUDIO_FORMAT_U8:
|
||||||
|
adder_orc_add_u8 ((gpointer) outmap.data,
|
||||||
|
(gpointer) inmap.data, inmap.size / bps);
|
||||||
|
break;
|
||||||
|
case GST_AUDIO_FORMAT_S8:
|
||||||
|
adder_orc_add_s8 ((gpointer) outmap.data,
|
||||||
|
(gpointer) inmap.data, inmap.size / bps);
|
||||||
|
break;
|
||||||
|
case GST_AUDIO_FORMAT_U16:
|
||||||
|
adder_orc_add_u16 ((gpointer) outmap.data,
|
||||||
|
(gpointer) inmap.data, inmap.size / bps);
|
||||||
|
break;
|
||||||
|
case GST_AUDIO_FORMAT_S16:
|
||||||
|
adder_orc_add_s16 ((gpointer) outmap.data,
|
||||||
|
(gpointer) inmap.data, inmap.size / bps);
|
||||||
|
break;
|
||||||
|
case GST_AUDIO_FORMAT_U32:
|
||||||
|
adder_orc_add_u32 ((gpointer) outmap.data,
|
||||||
|
(gpointer) inmap.data, inmap.size / bps);
|
||||||
|
break;
|
||||||
|
case GST_AUDIO_FORMAT_S32:
|
||||||
|
adder_orc_add_s32 ((gpointer) outmap.data,
|
||||||
|
(gpointer) inmap.data, inmap.size / bps);
|
||||||
|
break;
|
||||||
|
case GST_AUDIO_FORMAT_F32:
|
||||||
|
adder_orc_add_f32 ((gpointer) outmap.data,
|
||||||
|
(gpointer) inmap.data, inmap.size / bps);
|
||||||
|
break;
|
||||||
|
case GST_AUDIO_FORMAT_F64:
|
||||||
|
adder_orc_add_f64 ((gpointer) outmap.data,
|
||||||
|
(gpointer) inmap.data, inmap.size / bps);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (adder->info.finfo->format) {
|
switch (adder->info.finfo->format) {
|
||||||
case GST_AUDIO_FORMAT_U8:
|
case GST_AUDIO_FORMAT_U8:
|
||||||
|
|
|
@ -42,8 +42,6 @@ typedef struct _GstAdderClass GstAdderClass;
|
||||||
typedef struct _GstAdderPad GstAdderPad;
|
typedef struct _GstAdderPad GstAdderPad;
|
||||||
typedef struct _GstAdderPadClass GstAdderPadClass;
|
typedef struct _GstAdderPadClass GstAdderPadClass;
|
||||||
|
|
||||||
typedef void (*GstAdderFunction) (gpointer out, gpointer in, guint size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstAdder:
|
* GstAdder:
|
||||||
*
|
*
|
||||||
|
@ -60,9 +58,6 @@ struct _GstAdder {
|
||||||
/* the next are valid for both int and float */
|
/* the next are valid for both int and float */
|
||||||
GstAudioInfo info;
|
GstAudioInfo info;
|
||||||
|
|
||||||
/* function to add samples */
|
|
||||||
GstAdderFunction func;
|
|
||||||
|
|
||||||
/* counters to keep track of timestamps */
|
/* counters to keep track of timestamps */
|
||||||
gint64 offset;
|
gint64 offset;
|
||||||
|
|
||||||
|
|
|
@ -95,22 +95,22 @@ typedef union
|
||||||
#ifndef DISABLE_ORC
|
#ifndef DISABLE_ORC
|
||||||
#include <orc/orc.h>
|
#include <orc/orc.h>
|
||||||
#endif
|
#endif
|
||||||
void adder_orc_add_int32 (gint32 * ORC_RESTRICT d1,
|
void adder_orc_add_s32 (gint32 * ORC_RESTRICT d1,
|
||||||
const gint32 * ORC_RESTRICT s1, int n);
|
const gint32 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_int16 (gint16 * ORC_RESTRICT d1,
|
void adder_orc_add_s16 (gint16 * ORC_RESTRICT d1,
|
||||||
const gint16 * ORC_RESTRICT s1, int n);
|
const gint16 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
|
void adder_orc_add_s8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
|
||||||
int n);
|
int n);
|
||||||
void adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1,
|
void adder_orc_add_u32 (guint32 * ORC_RESTRICT d1,
|
||||||
const guint32 * ORC_RESTRICT s1, int n);
|
const guint32 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1,
|
void adder_orc_add_u16 (guint16 * ORC_RESTRICT d1,
|
||||||
const guint16 * ORC_RESTRICT s1, int n);
|
const guint16 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1,
|
void adder_orc_add_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
|
||||||
const guint8 * ORC_RESTRICT s1, int n);
|
int n);
|
||||||
void adder_orc_add_float32 (float *ORC_RESTRICT d1,
|
void adder_orc_add_f32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1,
|
||||||
const float *ORC_RESTRICT s1, int n);
|
int n);
|
||||||
void adder_orc_add_float64 (double *ORC_RESTRICT d1,
|
void adder_orc_add_f64 (double *ORC_RESTRICT d1, const double *ORC_RESTRICT s1,
|
||||||
const double *ORC_RESTRICT s1, int n);
|
int n);
|
||||||
void adder_orc_volume_u8 (guint8 * ORC_RESTRICT d1, int p1, int n);
|
void adder_orc_volume_u8 (guint8 * ORC_RESTRICT d1, int p1, int n);
|
||||||
void adder_orc_volume_s8 (gint8 * ORC_RESTRICT d1, int p1, int n);
|
void adder_orc_volume_s8 (gint8 * ORC_RESTRICT d1, int p1, int n);
|
||||||
void adder_orc_volume_u16 (guint16 * ORC_RESTRICT d1, int p1, int n);
|
void adder_orc_volume_u16 (guint16 * ORC_RESTRICT d1, int p1, int n);
|
||||||
|
@ -181,10 +181,10 @@ void adder_orc_add_volume_f64 (double *ORC_RESTRICT d1,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* adder_orc_add_int32 */
|
/* adder_orc_add_s32 */
|
||||||
#ifdef DISABLE_ORC
|
#ifdef DISABLE_ORC
|
||||||
void
|
void
|
||||||
adder_orc_add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
|
adder_orc_add_s32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -213,7 +213,7 @@ adder_orc_add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
_backup_adder_orc_add_int32 (OrcExecutor * ORC_RESTRICT ex)
|
_backup_adder_orc_add_s32 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = ex->n;
|
int n = ex->n;
|
||||||
|
@ -241,7 +241,7 @@ _backup_adder_orc_add_int32 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
adder_orc_add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
|
adder_orc_add_s32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
OrcExecutor _ex, *ex = &_ex;
|
OrcExecutor _ex, *ex = &_ex;
|
||||||
|
@ -256,16 +256,16 @@ adder_orc_add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
static const orc_uint8 bc[] = {
|
static const orc_uint8 bc[] = {
|
||||||
1, 9, 19, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
1, 9, 17, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
||||||
95, 105, 110, 116, 51, 50, 11, 4, 4, 12, 4, 4, 104, 0, 0, 4,
|
95, 115, 51, 50, 11, 4, 4, 12, 4, 4, 104, 0, 0, 4, 2, 0,
|
||||||
2, 0,
|
|
||||||
};
|
};
|
||||||
p = orc_program_new_from_static_bytecode (bc);
|
p = orc_program_new_from_static_bytecode (bc);
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_int32);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_s32);
|
||||||
#else
|
#else
|
||||||
p = orc_program_new ();
|
p = orc_program_new ();
|
||||||
orc_program_set_name (p, "adder_orc_add_int32");
|
orc_program_set_name (p, "adder_orc_add_s32");
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_int32);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_s32);
|
||||||
orc_program_add_destination (p, 4, "d1");
|
orc_program_add_destination (p, 4, "d1");
|
||||||
orc_program_add_source (p, 4, "s1");
|
orc_program_add_source (p, 4, "s1");
|
||||||
|
|
||||||
|
@ -293,10 +293,10 @@ adder_orc_add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* adder_orc_add_int16 */
|
/* adder_orc_add_s16 */
|
||||||
#ifdef DISABLE_ORC
|
#ifdef DISABLE_ORC
|
||||||
void
|
void
|
||||||
adder_orc_add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
|
adder_orc_add_s16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -325,7 +325,7 @@ adder_orc_add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
_backup_adder_orc_add_int16 (OrcExecutor * ORC_RESTRICT ex)
|
_backup_adder_orc_add_s16 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = ex->n;
|
int n = ex->n;
|
||||||
|
@ -353,7 +353,7 @@ _backup_adder_orc_add_int16 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
adder_orc_add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
|
adder_orc_add_s16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
OrcExecutor _ex, *ex = &_ex;
|
OrcExecutor _ex, *ex = &_ex;
|
||||||
|
@ -368,16 +368,16 @@ adder_orc_add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
static const orc_uint8 bc[] = {
|
static const orc_uint8 bc[] = {
|
||||||
1, 9, 19, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
1, 9, 17, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
||||||
95, 105, 110, 116, 49, 54, 11, 2, 2, 12, 2, 2, 71, 0, 0, 4,
|
95, 115, 49, 54, 11, 2, 2, 12, 2, 2, 71, 0, 0, 4, 2, 0,
|
||||||
2, 0,
|
|
||||||
};
|
};
|
||||||
p = orc_program_new_from_static_bytecode (bc);
|
p = orc_program_new_from_static_bytecode (bc);
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_int16);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_s16);
|
||||||
#else
|
#else
|
||||||
p = orc_program_new ();
|
p = orc_program_new ();
|
||||||
orc_program_set_name (p, "adder_orc_add_int16");
|
orc_program_set_name (p, "adder_orc_add_s16");
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_int16);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_s16);
|
||||||
orc_program_add_destination (p, 2, "d1");
|
orc_program_add_destination (p, 2, "d1");
|
||||||
orc_program_add_source (p, 2, "s1");
|
orc_program_add_source (p, 2, "s1");
|
||||||
|
|
||||||
|
@ -405,11 +405,10 @@ adder_orc_add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* adder_orc_add_int8 */
|
/* adder_orc_add_s8 */
|
||||||
#ifdef DISABLE_ORC
|
#ifdef DISABLE_ORC
|
||||||
void
|
void
|
||||||
adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
|
adder_orc_add_s8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1, int n)
|
||||||
int n)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
orc_int8 *ORC_RESTRICT ptr0;
|
orc_int8 *ORC_RESTRICT ptr0;
|
||||||
|
@ -437,7 +436,7 @@ adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
_backup_adder_orc_add_int8 (OrcExecutor * ORC_RESTRICT ex)
|
_backup_adder_orc_add_s8 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = ex->n;
|
int n = ex->n;
|
||||||
|
@ -465,8 +464,7 @@ _backup_adder_orc_add_int8 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
|
adder_orc_add_s8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1, int n)
|
||||||
int n)
|
|
||||||
{
|
{
|
||||||
OrcExecutor _ex, *ex = &_ex;
|
OrcExecutor _ex, *ex = &_ex;
|
||||||
static volatile int p_inited = 0;
|
static volatile int p_inited = 0;
|
||||||
|
@ -480,16 +478,15 @@ adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
static const orc_uint8 bc[] = {
|
static const orc_uint8 bc[] = {
|
||||||
1, 9, 18, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
1, 9, 16, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
||||||
95, 105, 110, 116, 56, 11, 1, 1, 12, 1, 1, 34, 0, 0, 4, 2,
|
95, 115, 56, 11, 1, 1, 12, 1, 1, 34, 0, 0, 4, 2, 0,
|
||||||
0,
|
|
||||||
};
|
};
|
||||||
p = orc_program_new_from_static_bytecode (bc);
|
p = orc_program_new_from_static_bytecode (bc);
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_int8);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_s8);
|
||||||
#else
|
#else
|
||||||
p = orc_program_new ();
|
p = orc_program_new ();
|
||||||
orc_program_set_name (p, "adder_orc_add_int8");
|
orc_program_set_name (p, "adder_orc_add_s8");
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_int8);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_s8);
|
||||||
orc_program_add_destination (p, 1, "d1");
|
orc_program_add_destination (p, 1, "d1");
|
||||||
orc_program_add_source (p, 1, "s1");
|
orc_program_add_source (p, 1, "s1");
|
||||||
|
|
||||||
|
@ -517,11 +514,11 @@ adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* adder_orc_add_uint32 */
|
/* adder_orc_add_u32 */
|
||||||
#ifdef DISABLE_ORC
|
#ifdef DISABLE_ORC
|
||||||
void
|
void
|
||||||
adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1,
|
adder_orc_add_u32 (guint32 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1,
|
||||||
const guint32 * ORC_RESTRICT s1, int n)
|
int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
orc_union32 *ORC_RESTRICT ptr0;
|
orc_union32 *ORC_RESTRICT ptr0;
|
||||||
|
@ -551,7 +548,7 @@ adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1,
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
_backup_adder_orc_add_uint32 (OrcExecutor * ORC_RESTRICT ex)
|
_backup_adder_orc_add_u32 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = ex->n;
|
int n = ex->n;
|
||||||
|
@ -581,8 +578,8 @@ _backup_adder_orc_add_uint32 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1,
|
adder_orc_add_u32 (guint32 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1,
|
||||||
const guint32 * ORC_RESTRICT s1, int n)
|
int n)
|
||||||
{
|
{
|
||||||
OrcExecutor _ex, *ex = &_ex;
|
OrcExecutor _ex, *ex = &_ex;
|
||||||
static volatile int p_inited = 0;
|
static volatile int p_inited = 0;
|
||||||
|
@ -596,16 +593,16 @@ adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1,
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
static const orc_uint8 bc[] = {
|
static const orc_uint8 bc[] = {
|
||||||
1, 9, 20, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
1, 9, 17, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
||||||
95, 117, 105, 110, 116, 51, 50, 11, 4, 4, 12, 4, 4, 105, 0, 0,
|
95, 117, 51, 50, 11, 4, 4, 12, 4, 4, 105, 0, 0, 4, 2, 0,
|
||||||
4, 2, 0,
|
|
||||||
};
|
};
|
||||||
p = orc_program_new_from_static_bytecode (bc);
|
p = orc_program_new_from_static_bytecode (bc);
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_uint32);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_u32);
|
||||||
#else
|
#else
|
||||||
p = orc_program_new ();
|
p = orc_program_new ();
|
||||||
orc_program_set_name (p, "adder_orc_add_uint32");
|
orc_program_set_name (p, "adder_orc_add_u32");
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_uint32);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_u32);
|
||||||
orc_program_add_destination (p, 4, "d1");
|
orc_program_add_destination (p, 4, "d1");
|
||||||
orc_program_add_source (p, 4, "s1");
|
orc_program_add_source (p, 4, "s1");
|
||||||
|
|
||||||
|
@ -633,11 +630,11 @@ adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* adder_orc_add_uint16 */
|
/* adder_orc_add_u16 */
|
||||||
#ifdef DISABLE_ORC
|
#ifdef DISABLE_ORC
|
||||||
void
|
void
|
||||||
adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1,
|
adder_orc_add_u16 (guint16 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1,
|
||||||
const guint16 * ORC_RESTRICT s1, int n)
|
int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
orc_union16 *ORC_RESTRICT ptr0;
|
orc_union16 *ORC_RESTRICT ptr0;
|
||||||
|
@ -665,7 +662,7 @@ adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1,
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
_backup_adder_orc_add_uint16 (OrcExecutor * ORC_RESTRICT ex)
|
_backup_adder_orc_add_u16 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = ex->n;
|
int n = ex->n;
|
||||||
|
@ -693,8 +690,8 @@ _backup_adder_orc_add_uint16 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1,
|
adder_orc_add_u16 (guint16 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1,
|
||||||
const guint16 * ORC_RESTRICT s1, int n)
|
int n)
|
||||||
{
|
{
|
||||||
OrcExecutor _ex, *ex = &_ex;
|
OrcExecutor _ex, *ex = &_ex;
|
||||||
static volatile int p_inited = 0;
|
static volatile int p_inited = 0;
|
||||||
|
@ -708,16 +705,16 @@ adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1,
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
static const orc_uint8 bc[] = {
|
static const orc_uint8 bc[] = {
|
||||||
1, 9, 20, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
1, 9, 17, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
||||||
95, 117, 105, 110, 116, 49, 54, 11, 2, 2, 12, 2, 2, 72, 0, 0,
|
95, 117, 49, 54, 11, 2, 2, 12, 2, 2, 72, 0, 0, 4, 2, 0,
|
||||||
4, 2, 0,
|
|
||||||
};
|
};
|
||||||
p = orc_program_new_from_static_bytecode (bc);
|
p = orc_program_new_from_static_bytecode (bc);
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_uint16);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_u16);
|
||||||
#else
|
#else
|
||||||
p = orc_program_new ();
|
p = orc_program_new ();
|
||||||
orc_program_set_name (p, "adder_orc_add_uint16");
|
orc_program_set_name (p, "adder_orc_add_u16");
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_uint16);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_u16);
|
||||||
orc_program_add_destination (p, 2, "d1");
|
orc_program_add_destination (p, 2, "d1");
|
||||||
orc_program_add_source (p, 2, "s1");
|
orc_program_add_source (p, 2, "s1");
|
||||||
|
|
||||||
|
@ -745,10 +742,10 @@ adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* adder_orc_add_uint8 */
|
/* adder_orc_add_u8 */
|
||||||
#ifdef DISABLE_ORC
|
#ifdef DISABLE_ORC
|
||||||
void
|
void
|
||||||
adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
|
adder_orc_add_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -777,7 +774,7 @@ adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
_backup_adder_orc_add_uint8 (OrcExecutor * ORC_RESTRICT ex)
|
_backup_adder_orc_add_u8 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = ex->n;
|
int n = ex->n;
|
||||||
|
@ -805,7 +802,7 @@ _backup_adder_orc_add_uint8 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
|
adder_orc_add_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
OrcExecutor _ex, *ex = &_ex;
|
OrcExecutor _ex, *ex = &_ex;
|
||||||
|
@ -820,16 +817,15 @@ adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
static const orc_uint8 bc[] = {
|
static const orc_uint8 bc[] = {
|
||||||
1, 9, 19, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
1, 9, 16, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
||||||
95, 117, 105, 110, 116, 56, 11, 1, 1, 12, 1, 1, 35, 0, 0, 4,
|
95, 117, 56, 11, 1, 1, 12, 1, 1, 35, 0, 0, 4, 2, 0,
|
||||||
2, 0,
|
|
||||||
};
|
};
|
||||||
p = orc_program_new_from_static_bytecode (bc);
|
p = orc_program_new_from_static_bytecode (bc);
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_uint8);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_u8);
|
||||||
#else
|
#else
|
||||||
p = orc_program_new ();
|
p = orc_program_new ();
|
||||||
orc_program_set_name (p, "adder_orc_add_uint8");
|
orc_program_set_name (p, "adder_orc_add_u8");
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_uint8);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_u8);
|
||||||
orc_program_add_destination (p, 1, "d1");
|
orc_program_add_destination (p, 1, "d1");
|
||||||
orc_program_add_source (p, 1, "s1");
|
orc_program_add_source (p, 1, "s1");
|
||||||
|
|
||||||
|
@ -857,11 +853,10 @@ adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* adder_orc_add_float32 */
|
/* adder_orc_add_f32 */
|
||||||
#ifdef DISABLE_ORC
|
#ifdef DISABLE_ORC
|
||||||
void
|
void
|
||||||
adder_orc_add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1,
|
adder_orc_add_f32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1, int n)
|
||||||
int n)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
orc_union32 *ORC_RESTRICT ptr0;
|
orc_union32 *ORC_RESTRICT ptr0;
|
||||||
|
@ -897,7 +892,7 @@ adder_orc_add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1,
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
_backup_adder_orc_add_float32 (OrcExecutor * ORC_RESTRICT ex)
|
_backup_adder_orc_add_f32 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = ex->n;
|
int n = ex->n;
|
||||||
|
@ -933,8 +928,7 @@ _backup_adder_orc_add_float32 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
adder_orc_add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1,
|
adder_orc_add_f32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1, int n)
|
||||||
int n)
|
|
||||||
{
|
{
|
||||||
OrcExecutor _ex, *ex = &_ex;
|
OrcExecutor _ex, *ex = &_ex;
|
||||||
static volatile int p_inited = 0;
|
static volatile int p_inited = 0;
|
||||||
|
@ -948,16 +942,16 @@ adder_orc_add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1,
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
static const orc_uint8 bc[] = {
|
static const orc_uint8 bc[] = {
|
||||||
1, 9, 21, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
1, 9, 17, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
||||||
95, 102, 108, 111, 97, 116, 51, 50, 11, 4, 4, 12, 4, 4, 200, 0,
|
95, 102, 51, 50, 11, 4, 4, 12, 4, 4, 200, 0, 0, 4, 2, 0,
|
||||||
0, 4, 2, 0,
|
|
||||||
};
|
};
|
||||||
p = orc_program_new_from_static_bytecode (bc);
|
p = orc_program_new_from_static_bytecode (bc);
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_float32);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_f32);
|
||||||
#else
|
#else
|
||||||
p = orc_program_new ();
|
p = orc_program_new ();
|
||||||
orc_program_set_name (p, "adder_orc_add_float32");
|
orc_program_set_name (p, "adder_orc_add_f32");
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_float32);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_f32);
|
||||||
orc_program_add_destination (p, 4, "d1");
|
orc_program_add_destination (p, 4, "d1");
|
||||||
orc_program_add_source (p, 4, "s1");
|
orc_program_add_source (p, 4, "s1");
|
||||||
|
|
||||||
|
@ -985,10 +979,10 @@ adder_orc_add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* adder_orc_add_float64 */
|
/* adder_orc_add_f64 */
|
||||||
#ifdef DISABLE_ORC
|
#ifdef DISABLE_ORC
|
||||||
void
|
void
|
||||||
adder_orc_add_float64 (double *ORC_RESTRICT d1, const double *ORC_RESTRICT s1,
|
adder_orc_add_f64 (double *ORC_RESTRICT d1, const double *ORC_RESTRICT s1,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1025,7 +1019,7 @@ adder_orc_add_float64 (double *ORC_RESTRICT d1, const double *ORC_RESTRICT s1,
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
_backup_adder_orc_add_float64 (OrcExecutor * ORC_RESTRICT ex)
|
_backup_adder_orc_add_f64 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = ex->n;
|
int n = ex->n;
|
||||||
|
@ -1061,7 +1055,7 @@ _backup_adder_orc_add_float64 (OrcExecutor * ORC_RESTRICT ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
adder_orc_add_float64 (double *ORC_RESTRICT d1, const double *ORC_RESTRICT s1,
|
adder_orc_add_f64 (double *ORC_RESTRICT d1, const double *ORC_RESTRICT s1,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
OrcExecutor _ex, *ex = &_ex;
|
OrcExecutor _ex, *ex = &_ex;
|
||||||
|
@ -1076,16 +1070,16 @@ adder_orc_add_float64 (double *ORC_RESTRICT d1, const double *ORC_RESTRICT s1,
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
static const orc_uint8 bc[] = {
|
static const orc_uint8 bc[] = {
|
||||||
1, 9, 21, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
1, 9, 17, 97, 100, 100, 101, 114, 95, 111, 114, 99, 95, 97, 100, 100,
|
||||||
95, 102, 108, 111, 97, 116, 54, 52, 11, 8, 8, 12, 8, 8, 212, 0,
|
95, 102, 54, 52, 11, 8, 8, 12, 8, 8, 212, 0, 0, 4, 2, 0,
|
||||||
0, 4, 2, 0,
|
|
||||||
};
|
};
|
||||||
p = orc_program_new_from_static_bytecode (bc);
|
p = orc_program_new_from_static_bytecode (bc);
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_float64);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_f64);
|
||||||
#else
|
#else
|
||||||
p = orc_program_new ();
|
p = orc_program_new ();
|
||||||
orc_program_set_name (p, "adder_orc_add_float64");
|
orc_program_set_name (p, "adder_orc_add_f64");
|
||||||
orc_program_set_backup_function (p, _backup_adder_orc_add_float64);
|
orc_program_set_backup_function (p, _backup_adder_orc_add_f64);
|
||||||
orc_program_add_destination (p, 8, "d1");
|
orc_program_add_destination (p, 8, "d1");
|
||||||
orc_program_add_source (p, 8, "s1");
|
orc_program_add_source (p, 8, "s1");
|
||||||
|
|
||||||
|
|
|
@ -80,14 +80,14 @@ typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void adder_orc_add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1, int n);
|
void adder_orc_add_s32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1, int n);
|
void adder_orc_add_s16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1, int n);
|
void adder_orc_add_s8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
|
void adder_orc_add_u32 (guint32 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
|
void adder_orc_add_u16 (guint16 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
|
void adder_orc_add_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_float32 (float * ORC_RESTRICT d1, const float * ORC_RESTRICT s1, int n);
|
void adder_orc_add_f32 (float * ORC_RESTRICT d1, const float * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_add_float64 (double * ORC_RESTRICT d1, const double * ORC_RESTRICT s1, int n);
|
void adder_orc_add_f64 (double * ORC_RESTRICT d1, const double * ORC_RESTRICT s1, int n);
|
||||||
void adder_orc_volume_u8 (guint8 * ORC_RESTRICT d1, int p1, int n);
|
void adder_orc_volume_u8 (guint8 * ORC_RESTRICT d1, int p1, int n);
|
||||||
void adder_orc_volume_s8 (gint8 * ORC_RESTRICT d1, int p1, int n);
|
void adder_orc_volume_s8 (gint8 * ORC_RESTRICT d1, int p1, int n);
|
||||||
void adder_orc_volume_u16 (guint16 * ORC_RESTRICT d1, int p1, int n);
|
void adder_orc_volume_u16 (guint16 * ORC_RESTRICT d1, int p1, int n);
|
||||||
|
|
|
@ -1,53 +1,52 @@
|
||||||
|
.function adder_orc_add_s32
|
||||||
.function adder_orc_add_int32
|
|
||||||
.dest 4 d1 gint32
|
.dest 4 d1 gint32
|
||||||
.source 4 s1 gint32
|
.source 4 s1 gint32
|
||||||
|
|
||||||
addssl d1, d1, s1
|
addssl d1, d1, s1
|
||||||
|
|
||||||
|
|
||||||
.function adder_orc_add_int16
|
.function adder_orc_add_s16
|
||||||
.dest 2 d1 gint16
|
.dest 2 d1 gint16
|
||||||
.source 2 s1 gint16
|
.source 2 s1 gint16
|
||||||
|
|
||||||
addssw d1, d1, s1
|
addssw d1, d1, s1
|
||||||
|
|
||||||
|
|
||||||
.function adder_orc_add_int8
|
.function adder_orc_add_s8
|
||||||
.dest 1 d1 gint8
|
.dest 1 d1 gint8
|
||||||
.source 1 s1 gint8
|
.source 1 s1 gint8
|
||||||
|
|
||||||
addssb d1, d1, s1
|
addssb d1, d1, s1
|
||||||
|
|
||||||
|
|
||||||
.function adder_orc_add_uint32
|
.function adder_orc_add_u32
|
||||||
.dest 4 d1 guint32
|
.dest 4 d1 guint32
|
||||||
.source 4 s1 guint32
|
.source 4 s1 guint32
|
||||||
|
|
||||||
addusl d1, d1, s1
|
addusl d1, d1, s1
|
||||||
|
|
||||||
|
|
||||||
.function adder_orc_add_uint16
|
.function adder_orc_add_u16
|
||||||
.dest 2 d1 guint16
|
.dest 2 d1 guint16
|
||||||
.source 2 s1 guint16
|
.source 2 s1 guint16
|
||||||
|
|
||||||
addusw d1, d1, s1
|
addusw d1, d1, s1
|
||||||
|
|
||||||
|
|
||||||
.function adder_orc_add_uint8
|
.function adder_orc_add_u8
|
||||||
.dest 1 d1 guint8
|
.dest 1 d1 guint8
|
||||||
.source 1 s1 guint8
|
.source 1 s1 guint8
|
||||||
|
|
||||||
addusb d1, d1, s1
|
addusb d1, d1, s1
|
||||||
|
|
||||||
|
|
||||||
.function adder_orc_add_float32
|
.function adder_orc_add_f32
|
||||||
.dest 4 d1 float
|
.dest 4 d1 float
|
||||||
.source 4 s1 float
|
.source 4 s1 float
|
||||||
|
|
||||||
addf d1, d1, s1
|
addf d1, d1, s1
|
||||||
|
|
||||||
.function adder_orc_add_float64
|
.function adder_orc_add_f64
|
||||||
.dest 8 d1 double
|
.dest 8 d1 double
|
||||||
.source 8 s1 double
|
.source 8 s1 double
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue