29 #include "../include/xf_harris_config.h"
42 xf::cv::Mat<XF_8UC1, HEIGHT, WIDTH, NPIX>& _dst,
43 unsigned short Thresh,
45 xf::cv::cornerHarris<FILTER_WIDTH, BLOCK_WIDTH, NMS_RADIUS, XF_8UC1, HEIGHT, WIDTH, NPIX, XF_USE_URAM>(_src, _dst,
59 ap_uint<INPUT_PTR_WIDTH>* img_inp, ap_uint<OUTPUT_PTR_WIDTH>* img_out,
int rows,
int cols,
int threshold,
int k) {
72 const int pCOLS =
WIDTH;
73 const int pNPC1 =
NPIX;
75 xf::cv::Mat<XF_8UC1, HEIGHT, WIDTH, NPIX> in_mat(
rows,
cols);
77 #pragma HLS stream variable=in_mat.data depth=2
80 xf::cv::Mat<XF_8UC1, HEIGHT, WIDTH, NPIX> out_mat(
rows,
cols);
82 #pragma HLS stream variable=out_mat.data depth=2
88 xf::cv::Array2xfMat<INPUT_PTR_WIDTH, XF_8UC1, HEIGHT, WIDTH, NPIX>(img_inp, in_mat);
89 xf::cv::cornerHarris<FILTER_WIDTH, BLOCK_WIDTH, NMS_RADIUS, XF_8UC1, HEIGHT, WIDTH, NPIX, XF_USE_URAM>(
90 in_mat, out_mat, threshold, k);
91 xf::cv::xfMat2Array<OUTPUT_PTR_WIDTH, XF_8UC1, HEIGHT, WIDTH, NPIX>(out_mat, img_out);
107 hls::stream<ap_uint<INPUT_PTR_WIDTH>>& img_in_axi_stream,
109 hls::stream<ap_uint<OUTPUT_PTR_WIDTH>>& img_out_axi_stream,
111 int rows,
int cols,
int threshold,
int k) {
113 #pragma HLS INLINE off
116 const int pCOLS =
WIDTH;
117 const int pNPC1 =
NPIX;
119 xf::cv::Mat<IN_TYPE, HEIGHT, WIDTH, NPIX> in_mat(
rows,
cols);
121 #pragma HLS stream variable=in_mat.data depth=2
124 xf::cv::Mat<OUT_TYPE, HEIGHT, WIDTH, NPIX> out_mat(
rows,
cols);
126 #pragma HLS stream variable=out_mat.data depth=2
133 accel_utils accel_utils_obj;
135 int dstMat_cols_align_npc = ((in_mat.cols + (
NPIX - 1)) >> XF_BITSHIFT(
NPIX)) << XF_BITSHIFT(
NPIX);
142 xf::cv::cornerHarris<FILTER_WIDTH, BLOCK_WIDTH, NMS_RADIUS, IN_TYPE, HEIGHT, WIDTH, NPIX, XF_USE_URAM>(
143 in_mat, out_mat, threshold, k);
148 int srcMat_cols_align_npc = ((out_mat.cols + (
NPIX - 1)) >> XF_BITSHIFT(
NPIX)) << XF_BITSHIFT(
NPIX);
151 srcMat_cols_align_npc);
166 #ifdef USE_HLSLIB_STREAM
167 hlslib::Stream<ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0>,
MIN_RX_LOOPS> &img_in_axi_stream,
168 hlslib::Stream<ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0>,
MIN_TX_LOOPS> &img_out_axi_stream,
170 hls::stream<ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0> >& img_in_axi_stream,
171 hls::stream<ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0> >& img_out_axi_stream,
173 unsigned int min_rx_loops,
174 unsigned int min_tx_loops) {
176 #pragma HLS INLINE off
181 ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0> tmp_in;
182 ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0> tmp_out;
183 for (
unsigned int i=0, j=0, k=0; k < 5 * (min_rx_loops + min_tx_loops); k++) {
184 cout <<
"Consuming input...i=" << i << endl;
185 if (!img_in_axi_stream.empty() && (i < min_rx_loops)) {
186 tmp_in = img_in_axi_stream.read();
190 tmp_out.data = tmp_in.data;
191 cout <<
"Filling output...j=" << j << endl;
192 if (!(img_out_axi_stream.full()) && (j < min_tx_loops)) {
193 img_out_axi_stream.write(tmp_out);
197 if (j == min_tx_loops) {
198 cout <<
"Full" << endl;
218 int rows,
int cols,
int threshold,
int k) {
220 #pragma HLS INLINE off
223 const int pCOLS =
WIDTH;
224 const int pNPC1 =
NPIX;
226 xf::cv::Mat<IN_TYPE, HEIGHT, WIDTH, NPIX> in_mat(
rows,
cols);
228 #pragma HLS stream variable=in_mat.data depth=2
232 xf::cv::Mat<OUT_TYPE, HEIGHT, WIDTH, NPIX> out_mat(
rows,
cols);
234 #pragma HLS stream variable=out_mat.data depth=2
243 xf::cv::Array2xfMat<MEMDW_512, XF_8UC1, HEIGHT, WIDTH, NPIX>(img_inp, in_mat);
248 xf::cv::xfMat2Array<MEMDW_512, XF_8UC1, HEIGHT, WIDTH, NPIX>(in_mat, img_out);
251 xf::cv::cornerHarris<FILTER_WIDTH, BLOCK_WIDTH, NMS_RADIUS, IN_TYPE, HEIGHT, WIDTH, NPIX, XF_USE_URAM>(
252 in_mat, out_mat, threshold, k);
255 xf::cv::xfMat2Array<MEMDW_512, XF_8UC1, HEIGHT, WIDTH, NPIX>(out_mat, img_out);
void cornerHarrisAccelMem(membus_t *img_inp, membus_t *img_out, int rows, int cols, int threshold, int k)
Top-level accelerated function of the Harris Application with array I/F.
void harris_accel(xf::cv::Mat< XF_8UC1, 16, 16, XF_NPPC1 > &_src, xf::cv::Mat< XF_8UC1, 16, 16, XF_NPPC1 > &_dst, unsigned short Thresh, unsigned short k)
Top-level accelerated function of the Harris Application with xf::cv I/F.
void cornerHarrisAccelArray(ap_uint< 8 > *img_inp, ap_uint< 64 > *img_out, int rows, int cols, int threshold, int k)
Top-level accelerated function of the Harris Application with array I/F.
void cornerHarrisAccelStream(hls::stream< ap_uint< 8 >> &img_in_axi_stream, hls::stream< ap_uint< 64 >> &img_out_axi_stream, int rows, int cols, int threshold, int k)
Top-level accelerated function of the Harris Application with array I/F.
void fakeCornerHarrisAccelStream(hls::stream< ap_axiu< 8, 0, 0, 0 > > &img_in_axi_stream, hls::stream< ap_axiu< 64, 0, 0, 0 > > &img_out_axi_stream, unsigned int min_rx_loops, unsigned int min_tx_loops)