.. _program_listing_file__tmp_ws_src_vitis_common_include_imgproc_xf_duplicateimage.hpp: Program Listing for File xf_duplicateimage.hpp ============================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/vitis_common/include/imgproc/xf_duplicateimage.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2019 Xilinx, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _XF_Duplicate_HPP_ #define _XF_Duplicate_HPP_ #ifndef __cplusplus #error C++ is needed to include this header #endif #include "../common/xf_common.hpp" #include "../common/xf_utility.hpp" #include "hls_stream.h" namespace xf { namespace cv { template void xFDuplicate(xf::cv::Mat& _src, xf::cv::Mat& _dst1, xf::cv::Mat& _dst2, uint16_t img_height, uint16_t img_width) { img_width = img_width >> XF_BITSHIFT(NPC); ap_uint<13> row, col; int readindex = 0, writeindex1 = 0, writeindex2 = 0; const int TRIP_COLS = COLS / NPC; Row_Loop: for (row = 0; row < img_height; row++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min=ROWS max=ROWS #pragma HLS LOOP_FLATTEN off // clang-format on Col_Loop: for (col = 0; col < img_width; col++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min = TRIP_COLS max = TRIP_COLS #pragma HLS pipeline // clang-format on XF_TNAME(SRC_T, NPC) tmp_src; tmp_src = _src.read(readindex++); _dst1.write(writeindex1++, tmp_src); _dst2.write(writeindex2++, tmp_src); } } } template void duplicateMat(xf::cv::Mat& _src, xf::cv::Mat& _dst1, xf::cv::Mat& _dst2) { // clang-format off #pragma HLS inline off // clang-format on xFDuplicate(_src, _dst1, _dst2, _src.rows, _src.cols); } template void xFDuplicate(xf::cv::Mat& _src, xf::cv::Mat& _dst1, xf::cv::Mat& _dst2, uint16_t img_height, uint16_t img_width) { img_width = img_width >> XF_BITSHIFT(NPC); ap_uint<13> row, col; int readindex = 0, writeindex1 = 0, writeindex2 = 0; const int TRIP_COLS = COLS / NPC; Row_Loop: for (row = 0; row < img_height; row++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min=ROWS max=ROWS #pragma HLS LOOP_FLATTEN off // clang-format on Col_Loop: for (col = 0; col < img_width; col++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min = TRIP_COLS max = TRIP_COLS #pragma HLS pipeline // clang-format on XF_TNAME(SRC_T, NPC) tmp_src; tmp_src = _src.read(readindex++); _dst1.write(writeindex1++, tmp_src); _dst2.write(writeindex2++, tmp_src); } } } template void xFDuplicates(xf::cv::Mat& _src, xf::cv::Mat& _dst1, xf::cv::Mat& _dst2, xf::cv::Mat& _dst3, uint16_t img_height, uint16_t img_width) { img_width = img_width >> XF_BITSHIFT(NPC); ap_uint<13> row, col; int readindex = 0, writeindex1 = 0, writeindex2 = 0, writeindex3 = 0; const int TRIP_COLS = COLS / NPC; Row_Loop: for (row = 0; row < img_height; row++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min=ROWS max=ROWS #pragma HLS LOOP_FLATTEN off // clang-format on Col_Loop: for (col = 0; col < img_width; col++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min = TRIP_COLS max = TRIP_COLS #pragma HLS pipeline // clang-format on XF_TNAME(SRC_T, NPC) tmp_src; tmp_src = _src.read(readindex++); _dst1.write(writeindex1++, tmp_src); _dst2.write(writeindex2++, tmp_src); _dst3.write(writeindex3++, tmp_src); } } } template void duplicateMat(xf::cv::Mat& _src, xf::cv::Mat& _dst1, xf::cv::Mat& _dst2) { // clang-format off #pragma HLS inline off // clang-format on xFDuplicate(_src, _dst1, _dst2, _src.rows, _src.cols); } template void duplicateimages(xf::cv::Mat& _src, xf::cv::Mat& _dst1, xf::cv::Mat& _dst2, xf::cv::Mat& _dst3) { // clang-format off #pragma HLS inline off // clang-format on xFDuplicates(_src, _dst1, _dst2, _dst3, _src.rows, _src.cols); } } // namespace cv } // namespace xf #endif