diff --git a/gst-libs/gst/video/video-orc-dist.c b/gst-libs/gst/video/video-orc-dist.c index f466ee6e2f..e39f7771e8 100644 --- a/gst-libs/gst/video/video-orc-dist.c +++ b/gst-libs/gst/video/video-orc-dist.c @@ -179,6 +179,10 @@ void video_orc_pack_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); void video_orc_pack_AY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void video_orc_unpack_VUYA (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void video_orc_pack_VUYA (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); void video_orc_unpack_RGB15_le (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n); void video_orc_unpack_RGB15_be (guint32 * ORC_RESTRICT d1, @@ -7940,6 +7944,218 @@ video_orc_pack_AY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, #endif +/* video_orc_unpack_VUYA */ +#ifdef DISABLE_ORC +void +video_orc_unpack_VUYA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) +{ + int i; + orc_union32 *ORC_RESTRICT ptr0; + const orc_union32 *ORC_RESTRICT ptr4; + orc_union32 var32; + orc_union32 var33; + + ptr0 = (orc_union32 *) d1; + ptr4 = (orc_union32 *) s1; + + + for (i = 0; i < n; i++) { + /* 0: loadl */ + var32 = ptr4[i]; + /* 1: swapl */ + var33.i = ORC_SWAP_L (var32.i); + /* 2: storel */ + ptr0[i] = var33; + } + +} + +#else +static void +_backup_video_orc_unpack_VUYA (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union32 *ORC_RESTRICT ptr0; + const orc_union32 *ORC_RESTRICT ptr4; + orc_union32 var32; + orc_union32 var33; + + ptr0 = (orc_union32 *) ex->arrays[0]; + ptr4 = (orc_union32 *) ex->arrays[4]; + + + for (i = 0; i < n; i++) { + /* 0: loadl */ + var32 = ptr4[i]; + /* 1: swapl */ + var33.i = ORC_SWAP_L (var32.i); + /* 2: storel */ + ptr0[i] = var33; + } + +} + +void +video_orc_unpack_VUYA (guint8 * ORC_RESTRICT d1, const guint8 * 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; + +#if 1 + static const orc_uint8 bc[] = { + 1, 9, 21, 118, 105, 100, 101, 111, 95, 111, 114, 99, 95, 117, 110, 112, + 97, 99, 107, 95, 86, 85, 89, 65, 11, 4, 4, 12, 4, 4, 184, 0, + 4, 2, 0, + }; + p = orc_program_new_from_static_bytecode (bc); + orc_program_set_backup_function (p, _backup_video_orc_unpack_VUYA); +#else + p = orc_program_new (); + orc_program_set_name (p, "video_orc_unpack_VUYA"); + orc_program_set_backup_function (p, _backup_video_orc_unpack_VUYA); + orc_program_add_destination (p, 4, "d1"); + orc_program_add_source (p, 4, "s1"); + + orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, + ORC_VAR_D1); +#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; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + + func = c->exec; + func (ex); +} +#endif + + +/* video_orc_pack_VUYA */ +#ifdef DISABLE_ORC +void +video_orc_pack_VUYA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) +{ + int i; + orc_union32 *ORC_RESTRICT ptr0; + const orc_union32 *ORC_RESTRICT ptr4; + orc_union32 var32; + orc_union32 var33; + + ptr0 = (orc_union32 *) d1; + ptr4 = (orc_union32 *) s1; + + + for (i = 0; i < n; i++) { + /* 0: loadl */ + var32 = ptr4[i]; + /* 1: swapl */ + var33.i = ORC_SWAP_L (var32.i); + /* 2: storel */ + ptr0[i] = var33; + } + +} + +#else +static void +_backup_video_orc_pack_VUYA (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union32 *ORC_RESTRICT ptr0; + const orc_union32 *ORC_RESTRICT ptr4; + orc_union32 var32; + orc_union32 var33; + + ptr0 = (orc_union32 *) ex->arrays[0]; + ptr4 = (orc_union32 *) ex->arrays[4]; + + + for (i = 0; i < n; i++) { + /* 0: loadl */ + var32 = ptr4[i]; + /* 1: swapl */ + var33.i = ORC_SWAP_L (var32.i); + /* 2: storel */ + ptr0[i] = var33; + } + +} + +void +video_orc_pack_VUYA (guint8 * ORC_RESTRICT d1, const guint8 * 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; + +#if 1 + static const orc_uint8 bc[] = { + 1, 9, 19, 118, 105, 100, 101, 111, 95, 111, 114, 99, 95, 112, 97, 99, + 107, 95, 86, 85, 89, 65, 11, 4, 4, 12, 4, 4, 184, 0, 4, 2, + 0, + }; + p = orc_program_new_from_static_bytecode (bc); + orc_program_set_backup_function (p, _backup_video_orc_pack_VUYA); +#else + p = orc_program_new (); + orc_program_set_name (p, "video_orc_pack_VUYA"); + orc_program_set_backup_function (p, _backup_video_orc_pack_VUYA); + orc_program_add_destination (p, 4, "d1"); + orc_program_add_source (p, 4, "s1"); + + orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, + ORC_VAR_D1); +#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; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + + func = c->exec; + func (ex); +} +#endif + + /* video_orc_unpack_RGB15_le */ #ifdef DISABLE_ORC void diff --git a/gst-libs/gst/video/video-orc-dist.h b/gst-libs/gst/video/video-orc-dist.h index 5046668b0f..19fdffd5b0 100644 --- a/gst-libs/gst/video/video-orc-dist.h +++ b/gst-libs/gst/video/video-orc-dist.h @@ -119,6 +119,8 @@ void video_orc_pack_NV24 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, co void video_orc_unpack_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); void video_orc_pack_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, int n); void video_orc_pack_AY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void video_orc_unpack_VUYA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void video_orc_pack_VUYA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); void video_orc_unpack_RGB15_le (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n); void video_orc_unpack_RGB15_be (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n); void video_orc_unpack_RGB15_le_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);