Buffer Concatenator

Plugin to concatenate multiple buffer in single one with saving specific order.

Table of Contents

Introduction

Buffer Concatenator plugin outputs buffer wich contains all buffers one by one in order specified in config.json. If in config.json specified for buffer input_5233 order 0 and for buffer input_0 order 1 the plugin output will look like:

[
  [input_5233][input_0]
]

Features

  • Concatenate buffers in specific order

  • Copy only first N bytes from input buffer

Getting Started

Prerequisites

  • Yocto SDK installed ### Installation

To compile:

source /opt/poky/4.0.10/environment-setup-cortexa65-poky-linux
mkdir build && cd build && cmake .. && make

For manual installation copy GStreamer plugin shared library and Edet_Operators library:

On host:

scp libbuffer_concatenator.so sima@<IP address of DaVinci board>:/tmp/

On DaVinci board:

sudo mv /tmp/libbuffer_concatenator.so /data/your_pipeline/libs/

Usage

Example GST launch string:

GST_PLUGIN_PATH="/data/YOLOV5/lib" \
GST_DEBUG=2 \
gst-launch-1.0 --gst-plugin-path="/data/YOLOV5/lib" \
simaaisrc location="/data/YOLOV5/dump/yuv_sample" node-name="allegrodec" \
! process-cvu config="/data/YOLOV5/etc/yolov5_pre_proc.json" source-node-name="allegrodec" buffers-list="allegrodec" \
! buffer_concat. \
simaaisrc location="/data/YOLOV5/dump/mla_out" node-name="mla-yolov5" \
! process-cvu config="/data/YOLOV5/etc/yolov5_post_proc.json" source-node-name="mla-yolov5" buffers-list="mla-yolov5" \
! buffer_concatenator config="/data/YOLOV5/etc/buffer_concat_config.json" name="buffer_concat" silent=false \
! fakesink

Configuration

Configuration file for this plugin:

{
  "version": 0.1,
  "node_name": "buffer_concat",
  "memory": {
    "cpu": 0,
    "next_cpu": 0 <================= Memory type used by allocator. 0 means A65 memory will be used
  },
  "system": {
    "out_buf_queue": 1, <=========== Num of output buffers created by the plugin
    "debug": 0,
    "dump_data": 0 <================ Dump the output buffer into file at /tmp
  },
  "buffers": {
    "input": [
      {
        "name": "buffer_1", <======= Name of input buffer
        "size": 36964400, <========= Size of input buffer
        "order": 0, <=============== Order of buffer in output buffer
        "offset" : 0, <============= Offset from which to start copying
        "copy_bytes" : 18482200 <=== Size how many bytes should be copied to output buffer
      },
      {
        "name": "buffer_2",
        "size": 73928800,
        "order": 1,
        "offset" : 36964400,
        "copy_bytes" : 36964400
      }
    ],
    "output": {
      "size": 55446600 <============ Output buffer size = Σ(sizes of input buffers specified in this json)
    }
  }
}

[WARNING] size of input buffer in configuration file should be less or equal to size of actual input buffer

Contributing

License

Acknowledgments