buffer bursty data using pixel stream fifo block -凯发k8网页登录
this example shows how to interface with bursty pixel streams, such as those from dma and camera link® sources, using the pixel stream fifo block.
overview
the system is shown below.
there are two pixel input streams - dma source and camera link source. input data for both sources is loaded from a .mat
file, in the initfcn
callback. the dma source models a non-contiguous stream of data arriving from off-chip memory. the pixels arrive in short bursts of random length, with random gaps between bursts. this can occur when there is contention on the dma source and so it is not possible to stream pixels continuously from off-chip memory. the camera link source models the case when the camera is streaming an image of a lower resolution than the maximum permitted by the pixel clock and therefore will leave regular gaps between valid pixels. this spacing allows for streaming of multiple resolution images using a common clock, via strobing of validin.
the camera link source models the incoming video stream from the sensor. the dma source models a video stream from a frame buffer in which previous frame data has been processed in order to produce an alpha channel, allowing for blending of previous frame data with the current stream.
the pixel stream overlay subsystem is shown in the diagram below. you can generate hdl code from this subsystem.
there are four main processing stages in the model - buffering of input data to remove burstiness, edge detection and overlay on camera link stream, alignment of pixel streams, and alpha blending of dma stream onto camera link stream.
pixel stream buffering
the pixel stream fifo blocks buffer the input data as it is streamed into the model. the pixel stream fifo is a masked subsystem. looking into the pixel stream fifo, we can see that it consists of a memory controller, read and write counters and two rams. one ram stores the incoming pixel stream, and the other stores the incoming control signal stream. once a full line has been buffered in ram, the line is output continuously, removing any bursty behavior seen at input.
this waveform illustrates the difference in the pixel control signals after the pixel stream fifo. the input valid
signal, dma_controlin(5)
, shows short bursts of valid pixels, while the output valid
, dma_ctrlclean(5)
, shows a continuous line of valid pixels. the total cycles in each line, shown by the time between hstart
assertions, remains the same.
edge detection and overlay on camera link stream
to further differentiate the pixel streams, the camera link stream has an edge detection and overlay section. the pixel stream is first pre-processed by the bilateral filter block. this block smooths the image while preserving edges, and so it is a good choice for noise suppression prior to edge detection. the edge detector block detects edges using the sobel method. the edges are then thinned using a [2x2] erosion operation. the thinned edge image is overlaid onto the original camera link image.
pixel stream alignment
the camera link and dma pixel streams must now be aligned to account for algorithmic delay in the data path. aligning the pixel streams is straightforward using the pixel stream aligner block.
alpha blending
the dma input stream is a [1x4] vector whereas the camera link input is a [1x3] vector. the extra column in the dma input is used to store the alpha channel information. the alpha channel represents the amount by which each of the pixels from the dma source should be blended with the incoming camera link stream.
results of the simulation
the output video stream shows the dma stream alpha blended onto the camera link input. the magenta colored overlay indicates the edges detected in the incoming camera link stream.
generate hdl code and verify its behavior
to check and generate the hdl code referenced in this example, you must have an hdl coder™ license.
to generate the hdl code, use the following command:
makehdl('dmacamerasourcehdl/pixel stream overlay');
to generate an hdl test bench, use the following command:
makehdltb('dmacamerasourcehdl/pixel stream overlay');