#define _get_objects_tf(bb, _type, typename, numinput, classinput, scoreinput, boxesinput, config, results) \
case typename: \
{ \
- int d; \
+ int d, num; \
+ size_t boxbpi; \
_type * num_detection_ = (_type *) numinput; \
_type * classes_ = (_type *) classinput; \
_type * scores_ = (_type *) scoreinput; \
_type * boxes_ = (_type *) boxesinput; \
- int num = (int) num_detection_[0]; \
+ num = (int) num_detection_[0]; \
results = g_array_sized_new (FALSE, TRUE, sizeof (detectedObject), num); \
- size_t boxbpi = config->info.info[3].dimension[0]; \
+ boxbpi = config->info.info[3].dimension[0]; \
for (d = 0; d < num; d++) { \
detectedObject object; \
object.valid = TRUE; \
tf_loadModelFile (const GstTensorFilterProperties * prop, void **private_data)
{
tf_data *tf;
+ gboolean tf_mem_optmz;
+
if (*private_data != NULL) {
tf = *private_data;
if (strcmp (prop->model_file, tf_core_getModelPath (tf->tf_private_data))) {
return 1;
}
}
+
+ tf_mem_optmz = nnsconf_get_value_bool (NNSCONF_VAL_TF_MEM_OPTMZ);
+
tf = g_new0 (tf_data, 1); /** initialize tf Fill Zero! */
*private_data = tf;
tf->tf_private_data = tf_core_new (prop->model_file);
- const gboolean tf_mem_optmz =
- nnsconf_get_value_bool (NNSCONF_VAL_TF_MEM_OPTMZ);
-
if (tf->tf_private_data) {
if (tf_core_init (tf->tf_private_data, prop, tf_mem_optmz)) {
g_printerr ("failed to initailize the object: tensorflow");
const gchar *
nnsconf_get_fullpath (const gchar * subpluginname, nnsconf_type_path type)
{
+ gchar *filename;
+ const gchar *ret;
+
nnsconf_loadconf (FALSE);
- gchar *filename =
- g_strconcat (subplugin_prefixes[type], subpluginname, ".so", NULL);
- const gchar *ret = nnsconf_get_fullpath_fromfile (filename, type);
+ filename = g_strconcat (subplugin_prefixes[type], subpluginname, ".so", NULL);
+ ret = nnsconf_get_fullpath_fromfile (filename, type);
g_free (filename);
return ret;
GstClockTime * current_time, tensor_time_sync_data sync)
{
GSList *walk = NULL;
- walk = collect->data;
gboolean isEOS = FALSE;
guint count = 0;
+ walk = collect->data;
while (walk) {
- GstCollectData *data = (GstCollectData *) walk->data;
- walk = g_slist_next (walk);
- GstBuffer *buf = NULL;
+ GstCollectData *data;
+ GstBuffer *buf;
+
+ data = (GstCollectData *) walk->data;
buf = gst_collect_pads_peek (collect, data);
+ walk = g_slist_next (walk);
if (buf == NULL) {
isEOS = TRUE;
walk = collect->data;
if (sync.mode == SYNC_BASEPAD) {
+ GstCollectData *data;
+ GstTensorCollectPadData *pad;
+ GstBuffer *buf;
+
walk = g_slist_nth (walk, sync.data_basepad.sink_id);
- GstCollectData *data = (GstCollectData *) walk->data;
- GstTensorCollectPadData *pad = (GstTensorCollectPadData *) data;
- GstBuffer *buf = NULL;
+ data = (GstCollectData *) walk->data;
+ pad = (GstTensorCollectPadData *) data;
+
buf = gst_collect_pads_peek (collect, data);
if (buf != NULL) {
if (pad->buffer != NULL)
GstTensorCollectPadData *pad = (GstTensorCollectPadData *) data;
GstCaps *caps = gst_pad_get_current_caps (pad->pad);
GstStructure *s = gst_caps_get_structure (caps, 0);
+ GstBuffer *buf;
gst_tensors_config_from_structure (&in_configs, s);
g_assert (gst_tensors_config_validate (&in_configs));
gst_caps_unref (caps);
walk = g_slist_next (walk);
-
- GstBuffer *buf = NULL;
-
buf = gst_collect_pads_peek (collect, data);
switch (sync.mode) {
gboolean * created, gint nth)
{
GSList *walk;
+ GstPad *pad;
+ GstTensorPad *tensorpad;
+ gchar *name;
+ GstEvent *event;
+ gchar *stream_id;
+ GstCaps *caps;
+ GstTensorConfig config;
+
walk = tensor_demux->srcpads;
while (walk) {
GstTensorPad *pad = (GstTensorPad *) walk->data;
walk = walk->next;
}
- GstPad *pad;
- GstTensorPad *tensorpad;
- gchar *name;
- GstEvent *event;
- gchar *stream_id;
- GstCaps *caps;
- GstTensorConfig config;
-
tensorpad = g_new0 (GstTensorPad, 1);
GST_DEBUG_OBJECT (tensor_demux, "createing pad: %d(%dth)",
tensor_demux->num_srcpads, nth);
g_assert (gst_buffer_n_memory (buf) == num_tensors);
for (i = 0; i < num_tensors; i++) {
+ GstTensorPad *srcpad;
+ GstBuffer *outbuf;
+ GstMemory *mem;
+ gboolean created;
+ GstClockTime ts;
+
if (tensor_demux->tensorpick != NULL) {
gboolean found = FALSE;
GList *list;
continue;
}
- GstTensorPad *srcpad;
- GstBuffer *outbuf;
- GstMemory *mem;
- gboolean created;
- GstClockTime ts;
srcpad = gst_tensor_demux_get_tensor_pad (tensor_demux, &created, i);
outbuf = gst_buffer_new ();
case PROP_TENSORPICK:
{
GList *list;
- char *p = "";
+ char *p;
GPtrArray *arr = g_ptr_array_new ();
gchar **strings;
for (l = 0; l < dim[3]; l++) {
for (i = 0; i < dim[2]; i++) {
for (k = 0; k < num_mem; k++) {
- size_t c = 1;
+ size_t c, s;
+
+ c = 1;
for (j = 0; j < LINEAR_SECOND + 1; j++)
c *= tensor_merge->tensors_config.info.info[k].dimension[j];
- size_t s = tensor_element_size[type] * c;
+ s = tensor_element_size[type] * c;
inptr = mInfo[k].data + (l * dim[2] + i) * s;
{
for (l = 0; l < dim[3]; l++) {
for (k = 0; k < num_mem; k++) {
- size_t c = 1;
+ size_t c, s;
+
+ c = 1;
for (j = 0; j < LINEAR_THIRD + 1; j++)
c *= tensor_merge->tensors_config.info.info[k].dimension[j];
- size_t s = tensor_element_size[type] * c;
+ s = tensor_element_size[type] * c;
inptr = mInfo[k].data + l * s;
case LINEAR_FOURTH:
{
for (k = 0; k < num_mem; k++) {
- size_t c = 1;
+ size_t c, s;
+
+ c = 1;
for (j = 0; j < LINEAR_FOURTH + 1; j++)
c *= tensor_merge->tensors_config.info.info[k].dimension[j];
- size_t s = tensor_element_size[type] * c;
+ s = tensor_element_size[type] * c;
inptr = mInfo[k].data;
memcpy (outptr, inptr, s);
const GValue * value, GParamSpec * pspec)
{
GstTensorSrcIIO *self;
- self = GST_TENSOR_SRC_IIO (object);
-
GstStateChangeReturn status;
GstState state;
+ self = GST_TENSOR_SRC_IIO (object);
+
/**
* No support for setting properties in PAUSED/PLAYING state as it needs to
* reset the device. To change the properties, user should stop the pipeline
strlen (CHANNELS_ENABLED_AUTO_CHAR))) {
self->channels_enabled = CHANNELS_ENABLED_AUTO;
} else {
- gint i;
+ gint i, num;
gint64 val;
gchar **strv;
gchar *endptr = NULL;
self->custom_channel_table =
g_hash_table_new (g_direct_hash, g_direct_equal);
strv = g_strsplit_set (param, ",;", -1);
- gint num = g_strv_length (strv);
+ num = g_strv_length (strv);
for (i = 0; i < num; i++) {
val = g_ascii_strtoull (strv[i], &endptr, 10);
if (errno == ERANGE || errno == EINVAL || (endptr == strv[i]
gst_tensor_get_size_from_channels (GList * channels)
{
guint size_bytes = 0;
+ guint remain = 0;
GList *list;
GstTensorSrcIIOChannelProperties *channel_prop = NULL;
for (list = channels; list != NULL; list = list->next) {
channel_prop = (GstTensorSrcIIOChannelProperties *) list->data;
- guint remain = size_bytes % channel_prop->storage_bytes;
+ remain = size_bytes % channel_prop->storage_bytes;
if (remain == 0) {
channel_prop->location = size_bytes;
} else {
* Caps are fixated based on the device source in _start().
*/
GstTensorSrcIIO *self;
- self = GST_TENSOR_SRC_IIO_CAST (src);
GstCaps *updated_caps, *fixated_caps;
+ self = GST_TENSOR_SRC_IIO_CAST (src);
+
if (self->is_tensor) {
GstTensorConfig tensor_config;
gst_tensor_info_copy (&tensor_config.info,
int inidx = 0, outidx=0; \
for(cl=0;cl<sl;cl++) \
for(ci=0;ci<si;ci++) \
- for(cj=0;cj<sj;cj++) \
- for(ck=0;ck<sk;ck++){ \
- outidx=si*sj*sk*cl + sj*sk*ci + sk*cj+ck; \
- inidx = SK*SJ*SI*l + SJ*SI*k + SI*j + i; \
- const uint8_t *_in = inptr+inidx*typesize; \
- uint8_t *_out = outptr + outidx *typesize; \
- nns_memcpy(_out, _in, typesize); \
+ for(cj=0;cj<sj;cj++) \
+ for(ck=0;ck<sk;ck++){ \
+ const uint8_t *_in; \
+ uint8_t *_out; \
+ outidx = si*sj*sk*cl + sj*sk*ci + sk*cj+ck; \
+ inidx = SK*SJ*SI*l + SJ*SI*k + SI*j + i; \
+ _in = inptr + inidx * typesize; \
+ _out = outptr + outidx *typesize; \
+ nns_memcpy(_out, _in, typesize); \
} \
} while(0);