Operator FrameBufferRandomRead (imaFlex)

Operator Library: Memory

This operator facilitates the random read of the buffered data. The frame data is transferred into the operator via link I. The random read of the data can be performed by transferring addresses to ports RColA (read column address) and RRowA (read row address). The operator uses the addresses to read the frame data by the given coordinates. The resulting output frame has the image dimensions of the address inputs. One VisualApplets resource of type RAM is required. Check 'Allocation of Device Resources' for more information.

The FrameBufferRandomRead operator buffers the image stream in the Frame Grabber RAM (DRAM). One VisualApplets resource of type RAM is required. 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 the Application Note: Shared Memory.

The operator has two states:

  • Write state: Input images are stored in the buffer. The operator works like a FIFO. If enough memory is available, multiple images can be stored in the buffer.

  • Read state: After an image has been fully stored in the memory, the memory is read-out using the addresses given at the inputs RColA and RRowA. The number of addresses and address link image dimensions define the output image's width and height.

The image data input and the address inputs are not synchronous to each other. They may have different image dimensions. Both address inputs RColA and RRowA have to be O-synchronous.

Note the timing of the input links: The address inputs must not be sourced by the same operator as the data link input I without buffering. This is, because while writing the image data into the operator, no addresses to read the current frame can be accepted. Only if the frame is fully stored into the buffer, addresses can be accepted. In many cases, the operator CreateBlankImage is used to generate the images for the addresses.

The operator uses large non-FPGA memory. If only small frames or lines have to be stored, consider using operators FrameMemoryRandomRd or LineMemoryRandomRd.

The operator can handle both, a two-dimensional image (Img Protocol = VALT_IMAGE2D), as well as a one-dimensional sequence of lines (Img Protocol = VALT_LINE1D). In the two-dimensional mode, full frames are processed, which means that reading can only start when a full frame has been written. Once the address ports (RColA and RRowA) receive the end of a frame, the frame's memory is available again and the next read addresses the next frame. The one-dimensional mode processes lines. As a result, reading can start as soon as one line has been written. The end of a line on the address port RColA releases the line's memory and the next RColA value will address the next line. RRowA is not used in the one-dimensional line mode and should be set to any constant value (CONST).

All pins allow empty frames, empty lines and varying line lengths.

The dimensions of input frames may exceed the dimension of the internal frames. The operator then cuts the incoming frames to the dimensions defined by MaxFrameWidth and MaxFrameHeight.

The maximum dimensions of the input images on port I can be defined bigger than there is actual storage in the RAM available. This allows for a flexible usage that can switch between very wide and very high images. The parameters MaxFrameWidth and MaxFrameHeight define the size of the image in storage. As a result, those two parameters must not define an image that is greater than the available storage.

Overflow Management with InfiniteSource

In the InfiniteSource mode images might get lost or become corrupted. This happens either, because the RAM is full and it can't accept any further data. Or the input bandwidth is too high for the shared memory interface. As soon as the operator reaches the overflow state, all incoming data is discarded. This leads to lost or corrupted entities (i.e. frames in 2D mode or lines in 1D mode). Corrupted images only occur, if the input bandwidth is too high, since the fill level is counted in full entities. The corrupted image occurs when part of the image has already been written to the RAM, but part of the image is discarded due to the overflow. As a result, reading a corrupted image leads to undefined output data. As soon as there is enough space in the RAM again and the shared memory interface allows data to be written to the RAM again, the operator recovers from the overflow and stops discarding the input data. The Overflow parameter indicates when an overflow occurred. With the OverflowClearMode parameter, you can define whether the Overflow is reset immediately after overflow recovery or whether you reset the overflow manually.

Operator Restrictions

  • There is no validity check on the read addresses. If the RColA is greater than or equal to MaxFrameWidth or if RRowA is greater than or equal to MaxFrameHeight (only in 2D mode), the operator reads random dummy values from the memory.

  • The restrictions for the link properties are always a maximum of 2^24-1 for the Max. Image Width and 2^17-1 for the Max. Image Height. However, if MaxFrameSizeMode is set to Auto, the following restrictions apply additionally:

    • In 2D-mode, if MaxFrameSizeMode is set to Auto, then I.MaxImgWidth * I.MaxImgHeight <= 2^RamAddressWidth.

    • In 1D-mode, if MaxFrameSizeMode is set to Auto, then I.MaxImgWidth <= 2^RamAddressWidth.

  • The parallelism of all input ports is 1.

Bandwidth Optimization

For optimal performance the used number of data bits should match as closely as possible the number provided in the module parameter RamDataWidth. The maximum bandwidth going through the operator is reached, if the product of bit width and kernel size is equal to the internal RAM port width RamDataWidth. Note that the internal bit width can be increased by the usage of kernels, but a full kernel will still be addressed as a single pixel.

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

I/O Properties

Property Value
Operator Type M
Input Links I, image data input
RColA, read column address for the pixel at I
RRowA, read row address for the pixel at I
Output Link O, image data output

Synchronous and Asynchronous Inputs

  • Synchronous Group: RColA and RRowA
  • Input I is asynchronous to the group.

Supported Link Format

Link Parameter Input Link I Input Link RColA Input Link RRowA Output Link O
Bit Width [1, 64]1 auto2 auto3 as I
Arithmetic {unsigned, signed} unsigned unsigned as I
Parallelism 1 1 1 as I
Kernel Columns [1, Ram Data Width / Bit Width / Kernel Rows]4 1 1 as I
Kernel Rows [1, Ram Data Width / Bit Width / Kernel Columns]5 1 1 as I
Img Protocol VALT_LINE1D / VALT_IMAGE2D as I as I as I
Color Format any VAF_GRAY VAF_GRAY as I
Color Flavor any FL_NONE FL_NONE as I
Max. Img Width 2^24-16 any as RColA as RColA
Max. Img Height 2^17-16 any as RColA as RColA

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].

The input bit width must not exceed the native RAM data width RamDataWidth.

2

The bit width of the column address is:

3

The bit width of the row address is:

4

BitWidth * Columns * Rows <= RamDataWidth

5

BitWidth * Columns * Rows <= RamDataWidth

6

The restrictions for the link properties are always a maximum of 2^24-1 for the Max. Image Width and 2^17-1 for the Max. Image Height. However, if MaxFrameSizeMode is set to Auto, the following restrictions apply additionally:

  • In 2D-mode, if MaxFrameSizeMode is set to Auto, then I.MaxImgWidth * I.MaxImgHeight <= 2^RamAddressWidth.

  • In 1D-mode, if MaxFrameSizeMode is set to Auto, then I.MaxImgWidth <= 2^RamAddressWidth.

Parameters

RamDataWidth
Type static write parameter
Default 0
Range Integer number

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

RamAddressWidth
Type static write parameter
Default 0
Range Integer number

This parameter provides the number of address bits that can be used. The number of available RAM slots is defined by 2^RamAddressWidth. The current RamAddressWidth depends on the hardware platform as well as on the current number of memory operators (i.e. operators that use a resource of type RAM) in the design.

MaxFrameSizeMode
Type dynamic write parameter
Default Auto
Range {Auto, Custom}

This parameter defines whether the parameters MaxFrameWidth and MaxFrameHeight should automatically follow the max. image dimension at input I (mode=Auto) or whether these parameters can be adjusted (mode=Custom). Custom mode enables setting a maximum frame dimension, which is customized for the application and may be much smaller than the limits from the input link. This way, more frames can be stored in the RAM. In mode Auto the link properties (Max.Img Width and Max.Img Height) of I, must not define a maximum image that is greater than the number of available slots in the memory (2^RamAddressWidth). If the link properties Max.Img Width and Max.Img Height of I define a maximum image that is bigger than the available memory space and you are in mode Custom, the MaxFrameSizeMode parameter cannot be edited anymore until the maximum image on the input link is defined smaller. This parameter cannot be written when the acquisition is running. In 1D-mode MaxFrameHeight and Max.Img Height of input I can be considered to be 1.

MaxFrameWidth
Type dynamic write parameter
Default 1024
Range [1, Max. Image Width at I]

This parameter sets the max. image width for the current image processing configuration. The lines of input frames that exceed this limit are cut to MaxFrameWidth. Reducing this number below the max. image width saves memory space and allows storing more frames. This parameter can only be edited when MaxFrameSizeMode is set to Custom. The product of MaxFrameHeight and MaxFrameWidth must not be greater than the number of available memory slots: 2^RamAddressWidth. In 1D-mode MaxFrameHeight can be considered to be 1. This parameter cannot be edited when the acquisition is running.

MaxFrameHeight
Type dynamic write parameter
Default 1024
Range [1, Max. Image Height at I]

This parameter sets the max. image height for the current image processing configuration. Input frames exceeding this height limit are cut to MaxFrameHeight. Reducing this number below the max. image height saves memory space and allows to store more frames. This parameter can only be edited when MaxFrameSizeMode is set to Custom and the Image Protocol is set to VALT_IMAGE2D. In 1D-mode MaxFrameHeight can be considered to be 1. The product of MaxFrameHeight and MaxFrameWidth must not be greater than the number of available memory slots: 2^RamAddressWidth. This parameter cannot be edited when the acquisition is running.

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

This parameter provides the fill level of the DRAM in percent.

MaxFrameCount
Type dynamic read parameter
Default 2^RamAddressWidth / (MaxFrameHeight * MaxFrameWidth)
Range [1, 2^RamAddressWidth]

This parameter provides the maximum number of frames that currently fit into the memory. The maximum number of frames that fit into the memory depends on the parameters RamAddressWidth, MaxFrameHeight and MaxFrameWidth.

MaxFrameCount = 2^RamAddressWidth / (MaxFrameHeight * MaxFrameWidth)

This parameter is inactive in 1D mode.

FrameCount
Type dynamic read parameter
Default 0
Range [0, MaxFrameCount]

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

This parameter is inactive in 1D mode.

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

The 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 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.

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

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 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).