[TensorMux] Remove memcopy
authorjijoong.moon <jijoong.moon@samsung.com>
Fri, 13 Jul 2018 04:22:46 +0000 (13:22 +0900)
committer함명주/동작제어Lab(SR)/Principal Engineer/삼성전자 <myungjoo.ham@samsung.com>
Mon, 16 Jul 2018 02:38:00 +0000 (11:38 +0900)
No need to use memcopy to make tensors buffer. gst_buffer_get_memory
is used to extract the mem from in buffer and use it after increase
ref count.

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
gst/tensor_mux/gsttensormux.c

index 23024de..0da4f08 100644 (file)
@@ -366,16 +366,8 @@ gst_tensor_mux_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
     gst_structure_get_int (s, "dim3", (int *) &dim[2]);
     gst_structure_get_int (s, "dim4", (int *) &dim[3]);
 
-    GstMapInfo info, sink_info;
-    size_t size = dim[0] * dim[1] * dim[2] * dim[3];
-
-    GstMemory *mem = gst_allocator_alloc (NULL, size, NULL);
-    gst_memory_map (mem, &info, GST_MAP_WRITE);
-    gst_buffer_map (buffer, &sink_info, GST_MAP_READ);
-    memcpy (info.data, sink_info.data, size);
-
-    gst_memory_unmap (mem, &info);
-    gst_buffer_unmap (buffer, &sink_info);
+    GstMemory *mem = gst_buffer_get_memory (buffer, 0);
+    gst_memory_ref (mem);
     gst_append_tensor (tensor_mux->outbuffer, mem, &dim);
 
     g_mutex_lock (&buf_mutex);