* @param[in] results The final results to be transfered.\r
*/\r
static void\r
-finalize (GstMapInfo *out_info, tensor_region *data, GArray *results)\r
+gst_tensor_top_detectedObjects_cropInfo (GstMapInfo *out_info, tensor_region *data, GArray *results)\r
{\r
\r
guint i;\r
guint size = sizeof (crop_region); /**Assuming crop_region is a structure with four integer fields */\r
- guint8 *out_data = out_info->data;\r
+ int *out_data = (int *)out_info->data;\r
crop_region region;\r
guint maxx = MIN (results->len, data->num);\r
-\r
for (i = 0; i < maxx; i++) {\r
detected_object *temp = &g_array_index (results, detected_object, i);\r
region.x = temp->x;\r
} while (i < results->len);\r
}\r
\r
+/**\r
+ * @brief Private function to initialize the meta info\r
+ */\r
+static void \r
+init_meta(GstTensorMetaInfo * meta, tensor_region * trData){\r
+ gst_tensor_meta_info_init (meta);\r
+ meta->type = _NNS_UINT32;\r
+ meta->dimension[0] = BOX_SIZE;\r
+ meta->dimension[1] = trData->num;\r
+ meta->media_type = _NNS_TENSOR;\r
+}\r
+\r
/** @brief tensordec-plugin's GstTensorDecoderDef callback */\r
static GstFlowReturn\r
tr_decode (void **pdata, const GstTensorsConfig *config,\r
const GstTensorMemory *input, GstBuffer *outbuf)\r
{\r
tensor_region *trData = *pdata;\r
+ GstTensorMetaInfo meta;\r
GstMapInfo out_info;\r
GstMemory *out_mem;\r
GArray *results = NULL;\r
const guint num_tensors = config->info.num_tensors;\r
gboolean need_output_alloc = gst_buffer_get_size (outbuf) == 0;\r
- const size_t size = (size_t) 4 * trData->num; /**4 field per block */\r
+ const size_t size = (size_t) 4 * trData->num * sizeof(uint32_t); /**4 field per block */\r
\r
g_assert (outbuf);\r
/**Ensure we have outbuf properly allocated */\r
GST_ERROR ("Failed to get output buffer, unknown mode %d.", trData->mode);\r
goto error_unmap;\r
}\r
- finalize (&out_info, trData, results);\r
+ gst_tensor_top_detectedObjects_cropInfo (&out_info, trData, results);\r
\r
g_array_free (results, TRUE);\r
\r
gst_memory_unmap (out_mem, &out_info);\r
\r
+ /** converting to Flexible tensor since \r
+ * info pad of tensor_crop has capability for flexible tensor stream \r
+ */\r
+ init_meta(&meta, trData);\r
+ out_mem = gst_tensor_meta_info_append_header(&meta, out_mem);\r
+\r
if (need_output_alloc)\r
gst_buffer_append_memory (outbuf, out_mem);\r
else\r
if (!_set_max_detection (data, max_detection, MOBILENET_SSD_DETECTION_MAX)) {\r
return NULL;\r
}\r
- str = g_strdup_printf ("testing");\r
+ str = g_strdup_printf("other/tensor-flexible, width=%u, height=%u, type=(int)32, dimension=%d:%d", data->i_width, data->i_height, BOX_SIZE, data->num);\r
caps = gst_caps_from_string (str);\r
setFramerateFromConfig (caps, config);\r
g_free (str);\r