Resource usage of xf_warpperspective too high
Closed this issue · 4 comments
Mentioned in #41, after solving the synthesis issue with warppspective, the synthesis result was too large to fit onto the target board.
For reference I hand-coded an implementation of the same inverse warp mapping.
Is there are a restriction of the use of the xf_warpperspective function? Perhaps it is only designed for larger boards and executes extremely fast?
xfopencv warp
hand coded warp
Code used:
#include "config_warp_xf.h"
void accel_warp(xf::Mat<XF_8UC1, XF_HEIGHT, XF_WIDTH, NPC1> &_src, xf::Mat<TYPE, XF_HEIGHT, XF_WIDTH, NPC1> &_dst)
{
const int pROWS = XF_HEIGHT;
const int pCOLS = XF_WIDTH;
const int pNPC1 = XF_NPPC8;
const int pDepth = pROWS * pCOLS;
#pragma HLS INTERFACE m_axi port=_src depth=pDepth offset=slave bundle=gmem
#pragma HLS INTERFACE m_axi port=_dst depth=pDepth offset=slave bundle=gmem
#pragma HLS INTERFACE s_axilite port=return bundle=control
#pragma HLS dataflow
float H[9] = {
0.86, 0.5, 10.38,
-0.5, 0.86, -20.34,
0, 0, 1
};
xf::warpPerspective<TRANSTYPE,XF_8UC1,XF_HEIGHT, XF_WIDTH,NPC1>(_src, _dst,H);
}
Hello @ps-george,
The resource utilization estimate depends on:
- Max image size set (XF_HEIGHT and XF_WIDTH values)
- Frequency of operation (clock frequency)
- Pixel parallelism (XF_NPPC1 or XF_NPPC8)
- Configuration type (Bilinear or Nearest-Neighbour)
It is not clear from your code, what values you had set for the above. Also, it is highly recommended to use Warptransform function to perform the perspective and affine geometric transformations, that would provide a better performance, at a lesser cost of resources compared to WarpAffine and WarpPerspective.
- Max image size was 160x120 for both.
- Frequency was 10ns for both.
- I believe this could be the main issue, it looks like above I had XF_NPPC8 set for the xfopencv implementation. I will try with NPPCC1 next week and report back.
- Configuration was Nearest-Neighbour.
Yes, ideally we would like to be using warptransform so that we can have streaming access, however had a couple of problems with that function, I'll open a separate issue for that.
WarpPerspective function is deprecated from 2019.1 release. WarpTransform is the recommended function to use.