Operator LineBuffer (imaFlex)

Operator Library: Memory

The LineBuffer operator buffers the image data stream in the Frame Grabber RAM (DRAM), which is a memory on the frame grabber but not in the FPGA. The LineBuffer operator is a replacement for the operator ImageBuffer, which is used for mE5 hardware platforms and provides the same features. imaFlex CXP-12 Quad and imaFlex CXP-12 Penta don't support the operator ImageBuffer, thus, when you convert a design from an mE5 hardware platform to an imaFlex CXP-12 Quad or imaFlex CXP-12 Penta platform, any instance of ImageBuffer is automatically replaced by an instance of LineBuffer.

One VisualApplets resource of type RAM is required. See 'Allocation of Device Resources' for more information. Multiple resources of type RAM use the same physical RAM with the shared memory concept. Documentation for how to use the shared memory is available in section ' Shared Memory Concept '. Additionally, the LineBuffer operator features region-of-interest (ROI) support. The total number of bits (bit width times parallelism) must not exceed the memory limitations of the respective frame grabber.

The operator causes a latency of at least one line. Reading a line is started as soon as the line is fully written into the buffer. If the output is blocked, the operator buffers the input data.

The operator works like a FIFO. The buffer operates on image lines resulting in a very short memory latency. Any completed line of input data is immediately forwarded to the output as long as it is within the selected region of interest and the following modules can consume the data fast enough. As a result, frame data from a camera can be forwarded to the PC while the current frame transfer is still ongoing. The latency between ingoing and outgoing data increases, if the buffer gets filled with more lines. This happens, when the output is blocked for some time, in particular because the following modules can't process data at the same rate as the input bandwidth. Thus, the memory will only be filled, if the operator can't output the data at the same rate as the input provides data. Often, the operator is used to compensate peak input bandwidths.

With the parameters XOffset, XLength, YOffset and YLength you can define a region of interest. If the input image width is less than the sum of the XOffset and XLength, the LineBuffer operator still reads the parameterized XLength. In this case, the operator outputs undefined memory content for the additional pixels. If the input image height is less than the requested output image height, the operator only outputs the available lines. If the input image height is lower than YOffset

In Line1D application mode, the YOffset and YLength settings have no effect.

To measure the fill level of the buffer, the operator provides the following parameters: FillLevel, LineCount, and Overflow. FillLevel shows the fill level of the RAM in percent. LineCount provides the current number of lines that are saved in the buffer. The Overflow parameter is set to 1 when FillLevel is close to or equal to 100% and the next image to be stored in the buffer will exceed the RAM capacity. In case of an overflow, input data is discarded and the input image height is reduced. Overflows can only occur, if the data source is not stoppable, which means that InfiniteSource is set to ENABLED. As a result of an overflow, incomplete images might be stored in the memory. Incomplete images are automatically finalized and incoming data is discarded until there is space in the buffer for the next line.

The InfiniteSource parameter is used to specify whether the operator receives a data stream which can't be stopped, i.e. an unbuffered stream from a camera. Read 'Infinite Sources / Connecting Cameras' for more information.

Operator Restrictions

  • Empty frames are not supported.

[Note] Available Memory Space

The operator provides the read-only parameter MaxLineCount which reports the maximum number of lines (defined by XLength) that fit in the RAM. This number further depends on the presence of other memory operators in the current design and the data bit width.

Available for Hardware Platforms
imaFlex CXP-12 Penta
imaFlex CXP-12 Quad

Bandwidth Optimization

In contrast to the ImageBuffer operator, the LineBuffer operator performs an automatic aggregation of pixels for matching the memory data width as close as possible, in order to reach an optimal performance.

If enabled by the ParallelismConverter parameter, you may adjust the output parallelism to a different value than the input parallelism. This enables defining an asymmetric peak data throughput between input and output of the operator. You can use this feature to avoid an additional instance of a PARALLELdn or PARALLELup operator when the following data processing pipeline needs to work with a different parallelism.

To enable the operator to handle long bursts of write data that exceed the available maximum bandwidth of the RAM, enable the WritePriority parameter. This is recommended with infinite data sources, such as cameras (InfiniteSource = ENABLED). When the available bandwidth of the RAM is exceeded due to a write burst, reading is inhibited. This allows temporarily more frequent write accesses to the RAM. If a camera delivers a burst of write data, it is expected that said burst is followed by a gap in the write data (otherwise the available RAM bandwidth is exceeded), which then can be used to temporarily ramp up the read bandwidth.

I/O Properties

Property Value
Operator Type M
Input Link I, image data input
Output Link O, image data output

Supported Link Format

Link Parameter Input Link I Output Link O
Bit Width [1, 64]12 as I
Arithmetic {unsigned, signed} as I
Parallelism any2 as I 2
Kernel Columns 1 as I
Kernel Rows 1 as I
Img Protocol {VALT_IMAGE2D, VALT_LINE1D} as I
Color Format any as I
Color Flavor any as I
Max. Img Width 2^31-13 as I
Max. Img Height 2^31-1 as I

1

The range of the input bit width is:

  • For unsigned inputs: [1, 64]

  • For signed inputs: [2, 64]

  • For unsigned color inputs: [3, 63]

  • For signed color inputs: [6, 63].

2

The product of the bit width and the parallelism must not exceed the native RAM data width: RamDataWidth.

3

If the LineBuffer operator converts the parallelism (ParallelismConverter = Yes), it automatically rounds the maximum image width at the output to the next multiple of O.Parallelism. If O.Parallelism is greater than I.Parallelism, I.MaxImgWidth must not be greater than 2^31-1-O.Parallelism so that the rounded maximum image width at the output doesn't exceed 2^31-1.

Parameters

RamDataWidth
Type static write parameter
Default 0
Range Integer number

This parameter provides the number of data bits that can be used.

XOffset
Type dynamic/static write parameter
Default 0
Range [0, Max.Img Width - XLength]

This parameter defines the x-coordinate of the upper left corner of the ROI.

The step size is the input parallelism.

XLength
Type dynamic/static write parameter
Default 1024
Range [input parallelism, min(Max.Img Width, (2^RAM address width - 1) * internal RAM parallelism) - XOffset]

This parameter defines the width of the ROI.

The step size is the input parallelism.

YOffset
Type dynamic/static write parameter
Default 0
Range [0, Max.Img Height - YLength]

This parameter defines the y-coordinate of the upper left corner of the ROI.

YLength
Type dynamic/static write parameter
Default 1024
Range [1, Max.Img Height - YOffset]

This parameter defines the height of the ROI.

ParallelismConverter
Type static write parameter
Default No
Range {Yes, No}

This parameter defines whether the LineBuffer operator implements a parallelism converter.

  • No: The operator doesn't perform a parallelism conversion. Input and output parallelism are always the same. When the input parallelism changes, the output parallelism is automatically changed to the new input parallelism value. The output parallelism can't be edited.

  • Yes: The operator performs a parallelism conversion. The output parallelism is completely independent from the input parallelism and can be edited at will.

InfiniteSource
Type static write parameter
Default DISABLED
Range {ENABLED, DISABLED}

The LineBuffer operator can be inserted directly behind a camera operator. In this case, the InfiniteSource parameter must be set to ENABLED. The operator will then perform active overflow management and make sure that the operator can properly recover from overflows. The overflow can occur either when the data sink behind the operator stops or pauses the transmission and the buffer fill level reaches its maximum or when the input bandwidth is too high so the write data can't be transferred to the external RAM. When InfiniteSource is set to DISABLED, an inhibit signal is generated that stops the proceeding operator from transferring data, if the buffer fill level or input bandwidth get too high.

The write prioritization is recommended for any operator that is used with the InfiniteSource parameter set to ENABLED. Consequently, it is recommended to set the WritePriority parameter to ENABLED, when the InfiniteSource parameter is set to ENABLED.

See 'Infinite Sources / Connecting Cameras' for more information.

WritePriority
Type static write parameter
Default DISABLED
Range {ENABLED, DISABLED}

The shared memory concept (' Shared Memory Concept ') usually distributes the bandwidth equally amongst all connected memory operators (operators that use a resource of type RAM). If the WritePriority is DISABLED), the LineBuffer operator assigns the same priority to reading and writing. By setting WritePriority to ENABLED), the LineBuffer operator prioritizes writing over reading, but only while the temporary memory data rate is higher than the available bandwidth. The temporary prioritization of write data leads to a temporary slow down of the read process. Consequently, the average bandwidth must not exceed the available bandwidth for the LineBuffer operator. The write prioritization is recommended for any operator that is used with the InfiniteSource parameter set to ENABLED. When using the write prioritization with a stoppable source, make sure that the write bandwidth isn't constantly high, otherwise reading from the LineBuffer is stopped until the buffer is full. Since the write prioritization is a configuration for an individual operator, the effect of the write prioritization decreases with each additional memory operator in the design.

FillLevel
Type dynamic read parameter
Default 0
Range [0%, 100%]

This parameter provides the fill level of DRAM in percent.

MaxLineCount
Type dynamic read parameter
Default 2^RAM address width / (XLength / internal RAM parallelism + 1)
Range [1, 2^RAM address width / 2]

This parameter provides the maximum number of lines that currently fit into the memory. The maximum number of lines that fit into the memory depends on the, RAM address width, which depends on the number of instantiated RAM operators.

LineCount
Type dynamic read parameter
Default 0
Range [0, MaxLineCount]

This parameter provides the current number of lines in the memory.

Overflow
Type dynamic read parameter
Default 0
Range [0, 3]

This parameter indicates a buffer overflow. It's a 2-bit bitmap, where each bit indicates a different type of overflow. Bit 0 indicates a fill level overflow and bit 1 indicates a write bandwidth overflow. How long the Overflow parameter shows an overflow, depends on the OverflowClearMode.

OverflowClearMode
Type dynamic write parameter
Default AutoClear
Range {AutoClear, ManualClear, ClearAfterRead, ClearWithProcessReset}

OverflowClearMode determines how the Overflow parameter is cleared when the operator has recovered from an overflow. You can only reset the overflow status with this parameter, if the operator is not in overflow state anymore.

Clear modes:

  • AutoClear: When the operator recovers from an overflow, the Overflow parameter is reset automatically.

  • ManualClear: When the operator recovers from an overflow, the Overflow parameter still shows the overflow until it is manually reset by writing ManualClear into the OverflowClearMode parameter. In this mode, a process reset (e.g. acquisition stop) doesn't clear the Overflow parameter, which means the overflow is still visible after the acquisition has stopped.

  • ClearAfterRead: When the operator recovers from an overflow, the Overflow parameter still shows the overflow until the Overflow parameter is read or a process reset occurs (e.g. when the acquisition is stopped).

  • ClearWithProcessReset: When the operator recovers from an overflow, the Overflow parameter still shows the overflow until a reset occurs (e.g. when the acquisition is stopped).