.. _program_listing_file__tmp_ws_src_vitis_common_include_imgproc_xf_resize.hpp: Program Listing for File xf_resize.hpp ====================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/vitis_common/include/imgproc/xf_resize.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_RESIZE_ #define _XF_RESIZE_ #include "xf_resize_headers.h" namespace xf { namespace cv { template void resize(xf::cv::Mat& _src, xf::cv::Mat& _dst) { // clang-format off #pragma HLS INLINE OFF // clang-format on assert(((INTERPOLATION_TYPE == XF_INTERPOLATION_NN) || (INTERPOLATION_TYPE == XF_INTERPOLATION_BILINEAR) || (INTERPOLATION_TYPE == XF_INTERPOLATION_AREA)) && "Incorrect parameters interpolation type"); assert(((_src.rows <= SRC_ROWS) && (_src.cols <= SRC_COLS)) && "SRC_ROWS and SRC_COLS should be greater than input image"); assert(((_dst.rows <= DST_ROWS) && (_dst.cols <= DST_COLS)) && "DST_ROWS and DST_COLS should be greater than output image"); if (INTERPOLATION_TYPE == XF_INTERPOLATION_AREA) { assert((((_src.rows < _dst.rows) && (_src.cols < _dst.cols)) || ((_src.rows >= _dst.rows) && (_src.cols >= _dst.cols))) && " For Area mode, Image can be upscaled or downscaled simultaneously across height & width. But it can't " "be upscaled across height & downscaled across width and vice versa. For example: input image-128x128 " "& output image-150x80 is not supported"); if ((_src.rows < _dst.rows) && (_src.cols < _dst.cols)) { xFResizeAreaUpScale> XF_BITSHIFT(NPC)), (DST_COLS >> XF_BITSHIFT(NPC))>( _src, _dst); } else if ((_src.rows >= _dst.rows) && (_src.cols >= _dst.cols)) { xFResizeAreaDownScale> XF_BITSHIFT(NPC)), (DST_COLS >> XF_BITSHIFT(NPC))>( _src, _dst); } return; } else { resizeNNBilinear(_src, _dst); } } } // namespace cv } // namespace xf #endif