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.
There is a 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 MaxNumberOfLines 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 port to a circular buffer, and 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 RAM Circular Buffer is a memory of 2M pixels,
where M is MaxNumberOfLines +
log2(LineBufferSize). The Line
Address Buffer has MaxNumberOfLines 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 your output. In this diagram, MaxNumberOfLines is
four, so there are four locations to store a line address in the buffer.
The diagram also shows a single location to store ctrl.Vstart
.
The delay between the two streams must be less than the time between
frame starts.