54 #include "../include/xf_median_blur_config.h"
67 xf::cv::Mat<TYPE, HEIGHT, WIDTH, NPC1>& imgOutput) {
70 xf::cv::medianBlur<WINDOW_SIZE, XF_BORDER_REPLICATE, TYPE, HEIGHT, WIDTH, NPC1>(imgInput, imgOutput);
84 ap_uint<INPUT_PTR_WIDTH>* img_in, ap_uint<OUTPUT_PTR_WIDTH>* img_out,
int rows,
int cols) {
94 const int pCOLS =
WIDTH;
95 const int pNPC1 =
NPIX;
97 xf::cv::Mat<XF_8UC1, HEIGHT, WIDTH, NPIX> imgInput(
rows,
cols);
99 #pragma HLS stream variable=imgInput.data depth=2
102 xf::cv::Mat<XF_8UC1, HEIGHT, WIDTH, NPIX> imgOutput(
rows,
cols);
104 #pragma HLS stream variable=imgOutput.data depth=2
110 xf::cv::Array2xfMat<INPUT_PTR_WIDTH, TYPE, HEIGHT, WIDTH, NPC1>(img_in, imgInput);
111 xf::cv::medianBlur<WINDOW_SIZE, XF_BORDER_REPLICATE, TYPE, HEIGHT, WIDTH, NPC1>(imgInput, imgOutput);
112 xf::cv::xfMat2Array<OUTPUT_PTR_WIDTH, XF_8UC1, HEIGHT, WIDTH, NPIX>(imgOutput, img_out);
117 #ifndef FAKE_MedianBlur
128 hls::stream<ap_uint<INPUT_PTR_WIDTH>>& img_in_axi_stream,
129 hls::stream<ap_uint<OUTPUT_PTR_WIDTH>>& img_out_axi_stream,
132 #pragma HLS INLINE off
134 xf::cv::Mat<TYPE, HEIGHT, WIDTH, NPIX> imgInput(
rows,
cols);
136 #pragma HLS stream variable=imgInput.data depth=2
139 xf::cv::Mat<TYPE, HEIGHT, WIDTH, NPIX> imgOutput(
rows,
cols);
141 #pragma HLS stream variable=imgOutput.data depth=2
148 accel_utils accel_utils_obj;
150 int dstMat_cols_align_npc = ((imgInput.cols + (
NPIX - 1)) >> XF_BITSHIFT(
NPIX)) << XF_BITSHIFT(
NPIX);
154 xf::cv::medianBlur<WINDOW_SIZE, XF_BORDER_REPLICATE, TYPE, HEIGHT, WIDTH, NPC1>(imgInput, imgOutput);
156 int srcMat_cols_align_npc = ((imgOutput.cols + (
NPIX - 1)) >> XF_BITSHIFT(
NPIX)) << XF_BITSHIFT(
NPIX);
159 srcMat_cols_align_npc);
172 #ifdef USE_HLSLIB_STREAM
173 hlslib::Stream<ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0>,
MIN_RX_LOOPS> &img_in_axi_stream,
174 hlslib::Stream<ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0>,
MIN_TX_LOOPS> &img_out_axi_stream,
176 hls::stream<ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0> >& img_in_axi_stream,
177 hls::stream<ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0> >& img_out_axi_stream,
179 unsigned int min_rx_loops,
180 unsigned int min_tx_loops) {
182 #pragma HLS INLINE off
187 ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0> tmp_in;
188 ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0> tmp_out;
189 for (
unsigned int i=0, j=0, k=0; k < 5 * (min_rx_loops + min_tx_loops); k++) {
190 cout <<
"Consuming input...i=" << i << endl;
191 if (!img_in_axi_stream.empty() && (i < min_rx_loops)) {
192 tmp_in = img_in_axi_stream.read();
196 tmp_out.data = tmp_in.data;
197 cout <<
"Filling output...j=" << j << endl;
198 if (!(img_out_axi_stream.full()) && (j < min_tx_loops)) {
199 img_out_axi_stream.write(tmp_out);
203 if (j == min_tx_loops) {
204 cout <<
"Full" << endl;
226 #pragma HLS INLINE off
228 xf::cv::Mat<TYPE, HEIGHT, WIDTH, NPIX> imgInput(
rows,
cols);
230 #pragma HLS stream variable=imgInput.data depth=2
233 #ifndef FAKE_MedianBlur
234 xf::cv::Mat<TYPE, HEIGHT, WIDTH, NPIX> imgOutput(
rows,
cols);
236 #pragma HLS stream variable=imgOutput.data depth=2
245 xf::cv::Array2xfMat<MEMDW_512, XF_8UC1, HEIGHT, WIDTH, NPIX>(img_inp, imgInput);
247 #ifdef FAKE_MedianBlur
250 xf::cv::xfMat2Array<MEMDW_512, XF_8UC1, HEIGHT, WIDTH, NPIX>(imgInput, img_out);
253 xf::cv::medianBlur<WINDOW_SIZE, XF_BORDER_REPLICATE, TYPE, HEIGHT, WIDTH, NPC1>(imgInput, imgOutput);
256 xf::cv::xfMat2Array<MEMDW_512, XF_8UC1, HEIGHT, WIDTH, NPIX>(imgOutput, img_out);