Align two streams of pixel data
Vision HDL Toolbox / Utilities
The Pixel Stream Aligner block synchronizes two pixel streams by delaying one stream to match the timing of a reference stream. Many Vision HDL Toolbox™ algorithms delay the pixel stream, and the amount of delay can change as you adjust algorithm parameters. You can use this block to align streams for overlaying, comparing, or combining two streams such as in a Gaussian blur operation. Connect the delayed stream to the refPixel and refCtrl input ports, and the earlier stream to the pixel and ctrl input ports.
This waveform diagram shows the input streams, pixelIn
and
refPixelIn
, and their associated control signals. The reference
input frame starts later than the pixelIn
frame. The output signals
show that the block delays pixelIn
to match the reference stream, and
that both output streams share control signals. The waveform shows the short latency
between the input refCtrl
and the output refCtrl
.
In this simulation, to accommodate the delay of four lines between the input streams,
the Maximum number of lines parameter must be set to at least
4.
This block uses a streaming pixel interface with a
pixelcontrol
bus for frame control signals. This interface enables the
block to operate independently of image size and format. All Vision HDL Toolbox blocks use the same streaming interface. The block accepts and returns a scalar
pixel value and a bus that contains five control signals. The control signals indicate the
validity of each pixel and its location in the frame. To convert a frame (pixel matrix) into a
serial pixel stream and control signals, use the Frame
To Pixels block. For a full description of the interface, see Streaming Pixel Interface.
The block stores the data from the pixel input port to a circular buffer and then reads the lines out to align with the reference control signals. The block also stores the address of the start of each line. To match the added processing delay of the buffer data path, the block delays the reference pixel data and control signals for around 10 cycles.
The diagram shows the architecture of the block. The RAM Circular Buffer is a memory of
2M pixels, where
M is Maximum number of lines +
log2(Line buffer size). The Line Address
Buffer has Maximum number of lines locations. If the number of
ctrl.Hstart
assertions before the first
refCtrl.Hstart
assertion is greater than the size of the Line
Address Buffer, the block overwrites both buffers and corrupts the output. In this
diagram, Maximum number of lines is four, so four locations exist
to store a line address in the buffer. The Frame Start Buffer is a single location to
store ctrl.Vstart
. The delay between the two streams must be less
than the time between frame starts.
When the input pixel is a vector, the block replicates the RAM Circular Buffer for each element of the vector.