.. _program_listing_file__tmp_ws_src_vitis_common_include_imgproc_xf_pyr_down.hpp: Program Listing for File xf_pyr_down.hpp ======================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/vitis_common/include/imgproc/xf_pyr_down.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_PYR_DOWN_ #define _XF_PYR_DOWN_ #include "hls_stream.h" #include "ap_int.h" #include "../common/xf_common.hpp" #include "xf_pyr_down_gaussian_blur.hpp" namespace xf { namespace cv { template void xFpyrDownKernel(xf::cv::Mat& _src, xf::cv::Mat& _dst, unsigned short in_rows, unsigned short in_cols) { // clang-format off #pragma HLS DATAFLOW // clang-format on hls::stream _filter_in; hls::stream _filter_out; unsigned int read_pointer = 0; for (int i = 0; i < in_rows; i++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min=1 max=ROWS // clang-format on for (int j = 0; j < in_cols; j++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min=1 max=COLS #pragma HLS PIPELINE II=1 // clang-format on _filter_in.write(_src.read(read_pointer)); read_pointer++; } } xFPyrDownGaussianBlur( _filter_in, _filter_out, 5, XF_BORDER_CONSTANT, in_rows, in_cols); unsigned int write_ptr = 0; for (int i = 0; i < in_rows; i++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min=1 max=ROWS // clang-format on for (int j = 0; j < in_cols; j++) { // clang-format off #pragma HLS LOOP_TRIPCOUNT min=1 max=COLS #pragma HLS PIPELINE II=1 // clang-format on XF_TNAME(TYPE, NPC) read_fil_out = _filter_out.read(); if (i % 2 == 0 && j % 2 == 0) { _dst.write(write_ptr, read_fil_out); write_ptr++; } } } return; } template void pyrDown(xf::cv::Mat& _src, xf::cv::Mat& _dst) { // clang-format off #pragma HLS INLINE OFF // clang-format on unsigned short input_height = _src.rows; unsigned short input_width = _src.cols; xFpyrDownKernel(_src, _dst, input_height, input_width); return; } } // namespace cv } // namespace xf #endif