[datareposrc] Add function to read flexible tensors
authorhyunil park <hyunil46.park@samsung.com>
Tue, 27 Jun 2023 04:13:41 +0000 (13:13 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Wed, 19 Jul 2023 08:00:32 +0000 (17:00 +0900)
commit866908be51e60ccf6792f255e96e2d7751cb3c4d
tree9f6980f85460f8eaa1a6bb9335700d6cd62b70a4
parent7639a4c64040a04de5b02ede32d9bcf442e669b8
[datareposrc] Add function to read flexible tensors

- If the tensor format of the caps of the JSON file is flexible,
  Reads a sample using the flexible meta information (sample_offset, tensor_size, tensor_count)
  of the JSON file and appends memory to GstBuffer as many as the number of flexible tensors.
- Add unit test
- Add checking if it is a flexible tensor after writing data to GstMemory

- Reference
  * The start offset for reading is sample_offset(sample size).
  * Save each flexible tensor stored in a sample to a gstbuffer according to each
    tensor_size, tensor_size can get tensor_size field in JSON file.
  * A shuffled index is mapped to an index of sample_offset field in JSON file.
  * A shuffled index is also mapped to an index of tensor_count field in JSON file
  * The index value is a number of cumulative tensors, so it is mapped to an index
    of tensor_size field in JSON file

Signed-off-by: hyunil park <hyunil46.park@samsung.com>
gst/datarepo/gstdatareposrc.c
gst/datarepo/gstdatareposrc.h
tests/nnstreamer_datarepo/unittest_datareposrc.cc