From d7775cffb99c9fc63757c0e6d665bd1bce523633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 6 Sep 2013 13:28:00 +0100 Subject: [PATCH] video: fix build without orc or older or versions ./.libs/libgstvideo-1.0.so: undefined reference to `video_orc_unpack_NV24' ./.libs/libgstvideo-1.0.so: undefined reference to `video_orc_pack_NV24' --- gst-libs/gst/video/video-orc-dist.c | 312 ++++++++++++++++++++++++++++ gst-libs/gst/video/video-orc-dist.h | 2 + 2 files changed, 314 insertions(+) diff --git a/gst-libs/gst/video/video-orc-dist.c b/gst-libs/gst/video/video-orc-dist.c index 51bcbf0c66..89833224c8 100644 --- a/gst-libs/gst/video/video-orc-dist.c +++ b/gst-libs/gst/video/video-orc-dist.c @@ -153,6 +153,10 @@ void video_orc_unpack_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); void video_orc_pack_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void video_orc_unpack_NV24 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void video_orc_pack_NV24 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n); 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); @@ -5916,6 +5920,314 @@ video_orc_pack_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, #endif +/* video_orc_unpack_NV24 */ +#ifdef DISABLE_ORC +void +video_orc_unpack_NV24 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int n) +{ + int i; + orc_union32 *ORC_RESTRICT ptr0; + const orc_int8 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; +#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) + volatile orc_int8 var33; +#else + orc_int8 var33; +#endif + orc_int8 var34; + orc_union16 var35; + orc_union32 var36; + orc_union16 var37; + + ptr0 = (orc_union32 *) d1; + ptr4 = (orc_int8 *) s1; + ptr5 = (orc_union16 *) s2; + + /* 0: loadpb */ + var33 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 1: loadb */ + var34 = ptr4[i]; + /* 2: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } + /* 3: loadw */ + var35 = ptr5[i]; + /* 4: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var37.i; + _dest.x2[1] = var35.i; + var36.i = _dest.i; + } + /* 5: storel */ + ptr0[i] = var36; + } + +} + +#else +static void +_backup_video_orc_unpack_NV24 (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union32 *ORC_RESTRICT ptr0; + const orc_int8 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; +#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) + volatile orc_int8 var33; +#else + orc_int8 var33; +#endif + orc_int8 var34; + orc_union16 var35; + orc_union32 var36; + orc_union16 var37; + + ptr0 = (orc_union32 *) ex->arrays[0]; + ptr4 = (orc_int8 *) ex->arrays[4]; + ptr5 = (orc_union16 *) ex->arrays[5]; + + /* 0: loadpb */ + var33 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 1: loadb */ + var34 = ptr4[i]; + /* 2: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } + /* 3: loadw */ + var35 = ptr5[i]; + /* 4: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var37.i; + _dest.x2[1] = var35.i; + var36.i = _dest.i; + } + /* 5: storel */ + ptr0[i] = var36; + } + +} + +void +video_orc_unpack_NV24 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * 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; + +#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, 78, 86, 50, 52, 11, 4, 4, 12, 1, 1, 12, 2, + 2, 14, 1, 255, 0, 0, 0, 20, 2, 196, 32, 16, 4, 195, 0, 32, + 5, 2, 0, + }; + p = orc_program_new_from_static_bytecode (bc); + orc_program_set_backup_function (p, _backup_video_orc_unpack_NV24); +#else + p = orc_program_new (); + orc_program_set_name (p, "video_orc_unpack_NV24"); + orc_program_set_backup_function (p, _backup_video_orc_unpack_NV24); + orc_program_add_destination (p, 4, "d1"); + orc_program_add_source (p, 1, "s1"); + orc_program_add_source (p, 2, "s2"); + orc_program_add_constant (p, 1, 0x000000ff, "c1"); + orc_program_add_temporary (p, 2, "t1"); + + orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_S1, + ORC_VAR_D1); + orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S2, + 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; + ex->arrays[ORC_VAR_S2] = (void *) s2; + + func = c->exec; + func (ex); +} +#endif + + +/* video_orc_pack_NV24 */ +#ifdef DISABLE_ORC +void +video_orc_pack_NV24 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n) +{ + int i; + orc_int8 *ORC_RESTRICT ptr0; + orc_union16 *ORC_RESTRICT ptr1; + const orc_union32 *ORC_RESTRICT ptr4; + orc_union32 var33; + orc_union16 var34; + orc_int8 var35; + orc_union16 var36; + + ptr0 = (orc_int8 *) d1; + ptr1 = (orc_union16 *) d2; + ptr4 = (orc_union32 *) s1; + + + for (i = 0; i < n; i++) { + /* 0: loadl */ + var33 = ptr4[i]; + /* 1: splitlw */ + { + orc_union32 _src; + _src.i = var33.i; + var34.i = _src.x2[1]; + var36.i = _src.x2[0]; + } + /* 2: storew */ + ptr1[i] = var34; + /* 3: select1wb */ + { + orc_union16 _src; + _src.i = var36.i; + var35 = _src.x2[1]; + } + /* 4: storeb */ + ptr0[i] = var35; + } + +} + +#else +static void +_backup_video_orc_pack_NV24 (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_int8 *ORC_RESTRICT ptr0; + orc_union16 *ORC_RESTRICT ptr1; + const orc_union32 *ORC_RESTRICT ptr4; + orc_union32 var33; + orc_union16 var34; + orc_int8 var35; + orc_union16 var36; + + ptr0 = (orc_int8 *) ex->arrays[0]; + ptr1 = (orc_union16 *) ex->arrays[1]; + ptr4 = (orc_union32 *) ex->arrays[4]; + + + for (i = 0; i < n; i++) { + /* 0: loadl */ + var33 = ptr4[i]; + /* 1: splitlw */ + { + orc_union32 _src; + _src.i = var33.i; + var34.i = _src.x2[1]; + var36.i = _src.x2[0]; + } + /* 2: storew */ + ptr1[i] = var34; + /* 3: select1wb */ + { + orc_union16 _src; + _src.i = var36.i; + var35 = _src.x2[1]; + } + /* 4: storeb */ + ptr0[i] = var35; + } + +} + +void +video_orc_pack_NV24 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + 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, 78, 86, 50, 52, 11, 1, 1, 11, 2, 2, 12, 4, 4, 20, + 2, 198, 1, 32, 4, 189, 0, 32, 2, 0, + }; + p = orc_program_new_from_static_bytecode (bc); + orc_program_set_backup_function (p, _backup_video_orc_pack_NV24); +#else + p = orc_program_new (); + orc_program_set_name (p, "video_orc_pack_NV24"); + orc_program_set_backup_function (p, _backup_video_orc_pack_NV24); + orc_program_add_destination (p, 1, "d1"); + orc_program_add_destination (p, 2, "d2"); + orc_program_add_source (p, 4, "s1"); + orc_program_add_temporary (p, 2, "t1"); + + orc_program_append_2 (p, "splitlw", 0, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_S1, + 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; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_D2] = d2; + ex->arrays[ORC_VAR_S1] = (void *) s1; + + func = c->exec; + func (ex); +} +#endif + + /* video_orc_unpack_A420 */ #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 cb4ecb8f8d..cf0b9823e5 100644 --- a/gst-libs/gst/video/video-orc-dist.h +++ b/gst-libs/gst/video/video-orc-dist.h @@ -107,6 +107,8 @@ void video_orc_unpack_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRIC void video_orc_pack_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); void video_orc_unpack_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); void video_orc_pack_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void video_orc_unpack_NV24 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void video_orc_pack_NV24 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); 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_resample_bilinear_u32 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int p1, int p2, int n);