buffer_concatenator

This plugin is designed to concatenate multiple smaller buffers into a larger buffer, effectively improving throughput or compatibility with downstream elements that expect larger, consolidated data chunks.

The buffer_concatenator outputs buffer which contains all buffers one-by-one in the order specified in the config.json file. 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]
]

Properties

  • Concatenate buffers in a specific order

  • Copy only first N bytes from input buffer

Property

Description

max-size

Maximum size (in bytes) for the concatenated buffer

max-buffers

Maximum number of buffers to concatenate

max-time

Maximum time (in nanoseconds) to hold before pushing

drop-incomplete

If true, drops any remaining incomplete buffers on EOS

passthrough

If true, bypasses concatenation (for debugging or dynamic switching)

Installation

The Yocto SDK must be installed. 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 GStreamer 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] The size of the input buffer in the configuration file should be less or equal to the size of the actual input buffer.