215 lines
3.9 KiB
C
215 lines
3.9 KiB
C
|
|
|
|||
|
|
#ifndef ALGO_GLOBALS_H
|
|||
|
|
#define ALGO_GLOBALS_H
|
|||
|
|
|
|||
|
|
#include "ap_int.h"
|
|||
|
|
#include "hls_stream.h"
|
|||
|
|
|
|||
|
|
#define VITIS_HLS 1
|
|||
|
|
|
|||
|
|
#define RGN_DATA_WIN_SIZE 16
|
|||
|
|
#define RGN_DATA_PIXEL_WIDTH 2 //output 2 pixels per clock
|
|||
|
|
#define MAX_PT_NUM 3071
|
|||
|
|
|
|||
|
|
#define CAM2K_Y_WIDTH 12 //after calibration, may exceed 2048
|
|||
|
|
#define CAM4K_Y_WIDTH 13 //after calibration, may exceed 4096
|
|||
|
|
#define CAM4K_Y_RSV_BITS (16-13)
|
|||
|
|
|
|||
|
|
#define ROW_COUNT 3072
|
|||
|
|
#define CAM_MAX_Y (ROW_COUNT-1)
|
|||
|
|
|
|||
|
|
union CharFloat
|
|||
|
|
{
|
|||
|
|
float fdata;
|
|||
|
|
unsigned char buff[4];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
union UintDouble
|
|||
|
|
{
|
|||
|
|
double fdata;
|
|||
|
|
unsigned int buff[2];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
union UintFloat
|
|||
|
|
{
|
|||
|
|
float fdata;
|
|||
|
|
unsigned int unData;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct PeakRun{
|
|||
|
|
ap_uint<8> start;
|
|||
|
|
ap_uint<8> len;
|
|||
|
|
ap_uint<8> value;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct RgnPix
|
|||
|
|
{
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> LazerWinX; //winStartX
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> LazerWinY;
|
|||
|
|
ap_uint<11> LazerWinRid;
|
|||
|
|
ap_uint<4> LazerWinFlag; //bit0:OverLap | bit1:Rflct
|
|||
|
|
ap_uint<1> LazerWinRsv;
|
|||
|
|
ap_uint<2> Sync; //FrmSync:b10 | LineSync:b01
|
|||
|
|
ap_uint<8> RltvRdx; // bit3~0:Str | bit7~4:End
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct RgnPixConvolve
|
|||
|
|
{
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> LazerWinX; //winStartX
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> LazerWinY;
|
|||
|
|
ap_uint<11> LazerWinRid;
|
|||
|
|
ap_uint<4> LazerWinFlag; //bit0:OverLap | bit1:Rflct
|
|||
|
|
ap_uint<1> LazerWinRsv;
|
|||
|
|
ap_uint<2> Sync; //FrmSync:b10 | LineSync:b01
|
|||
|
|
ap_uint<8> value;
|
|||
|
|
int nD1;
|
|||
|
|
int nD2;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct RgnSubPix
|
|||
|
|
{
|
|||
|
|
float x;
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> y; //support up to 4k camera
|
|||
|
|
ap_uint<11> rid;
|
|||
|
|
ap_uint<4> flag; //bit0:OverLap | bit1:Rflct
|
|||
|
|
ap_uint<1> rsv;
|
|||
|
|
ap_uint<2> Sync; //FrmSync:b10 | LineSync:b01
|
|||
|
|
ap_uint<8> value;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct RgnSubPixCalib
|
|||
|
|
{
|
|||
|
|
float x;
|
|||
|
|
float y;
|
|||
|
|
ap_uint<11> rid;
|
|||
|
|
ap_uint<4> flag; //bit0:OverLap | bit1:Rflct
|
|||
|
|
ap_uint<1> rsv;
|
|||
|
|
ap_uint<2> Sync; //FrmSync:b10 | LineSync:b01
|
|||
|
|
ap_uint<8> value;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct InterpolateCalibSubpix
|
|||
|
|
{
|
|||
|
|
float x;
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> y; //support up to 4k camera
|
|||
|
|
ap_uint<11> rid;
|
|||
|
|
ap_uint<8> value;
|
|||
|
|
ap_uint<2> flag; //bit0:OverLap | bit1:Rflct
|
|||
|
|
ap_uint<2> Sync; //FrmSync:b10 | LineSync:b01
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct BuffCalibSubpix
|
|||
|
|
{
|
|||
|
|
float x;
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> y; //support up to 4k camera
|
|||
|
|
ap_uint<11> rid;
|
|||
|
|
ap_uint<8> value;
|
|||
|
|
ap_uint<2> flag; //bit0:OverLap | bit1:Rflct
|
|||
|
|
ap_uint<2> matchFlag; //1<><31> L-R match; 2- L single side; 3: R single side
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct LRMatchedPoint
|
|||
|
|
{
|
|||
|
|
float xL;
|
|||
|
|
float xR;
|
|||
|
|
ap_uint<14> y; //may exceed 2048
|
|||
|
|
ap_uint<8> valueL;
|
|||
|
|
ap_uint<8> valueR;
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> match_seg_id;
|
|||
|
|
ap_uint<2> matchFlag;
|
|||
|
|
ap_uint<2> Sync; //FrmSync:b10 | LineSync:b01
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct SubpixInfo
|
|||
|
|
{
|
|||
|
|
float x;
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> y;
|
|||
|
|
ap_uint<11> rid;
|
|||
|
|
ap_uint<4> flag; //bit0:OverLap | bit1:Rflct
|
|||
|
|
ap_uint<1> rsv;
|
|||
|
|
ap_uint<8> value;
|
|||
|
|
};
|
|||
|
|
union Byte8
|
|||
|
|
{
|
|||
|
|
//SubpixInfo subpix;
|
|||
|
|
unsigned int nData[2];
|
|||
|
|
float fData[2];
|
|||
|
|
double dData;
|
|||
|
|
};
|
|||
|
|
struct CalibData
|
|||
|
|
{
|
|||
|
|
double calibK[2];
|
|||
|
|
//double calibK_ext[2];
|
|||
|
|
//SubCalib subpix_calib;
|
|||
|
|
ap_uint<2> Sync; //FrmSync:b10 | LineSync:b01
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct Pnt3D
|
|||
|
|
{
|
|||
|
|
float x;
|
|||
|
|
float y;
|
|||
|
|
float z;
|
|||
|
|
ap_uint<8> valueL;
|
|||
|
|
ap_uint<8> valueR;
|
|||
|
|
ap_uint<2> matchFlag;
|
|||
|
|
ap_uint<2> Sync; //FrmSync:b10 | LineSync:b01
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct SRowData
|
|||
|
|
{
|
|||
|
|
ap_uint<4> ptNum;
|
|||
|
|
BuffCalibSubpix pt1;
|
|||
|
|
BuffCalibSubpix pt2;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct SPointMatchInfo
|
|||
|
|
{
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> match_seg_id;
|
|||
|
|
ap_uint<2> match_flag; //1: L-R match; 2:left single; 3: right single
|
|||
|
|
ap_uint<11> rid_L;
|
|||
|
|
ap_uint<11> rid_R;
|
|||
|
|
ap_uint<2> pt_idx_L;
|
|||
|
|
ap_uint<2> pt_idx_R;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct SLineMatchInfo
|
|||
|
|
{
|
|||
|
|
ap_uint<2> matchNum;
|
|||
|
|
SPointMatchInfo match1;
|
|||
|
|
SPointMatchInfo match2;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct SMatchSegInfo
|
|||
|
|
{
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> seg_id;
|
|||
|
|
ap_uint<CAM4K_Y_WIDTH> seg_ptSize;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct SLRMatchOutput
|
|||
|
|
{
|
|||
|
|
ap_uint<4> left_ptNum;
|
|||
|
|
BuffCalibSubpix left_pt1;
|
|||
|
|
BuffCalibSubpix left_pt2;
|
|||
|
|
ap_uint<4> right_ptNum;
|
|||
|
|
BuffCalibSubpix right_pt1;
|
|||
|
|
BuffCalibSubpix right_pt2;
|
|||
|
|
SLineMatchInfo matchInfo;
|
|||
|
|
ap_uint<2> syncWord;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#if 0
|
|||
|
|
struct RgnPnt {
|
|||
|
|
ap_uint<12> winStartX;
|
|||
|
|
ap_uint<12> y;
|
|||
|
|
ap_uint<11> rid_data; //HSync=1:rid; HSync=0:data
|
|||
|
|
ap_uint<1> overlalFlag;
|
|||
|
|
ap_uint<1> reflectFlag;
|
|||
|
|
ap_uint<1> rsvd;
|
|||
|
|
ap_uint<1> VSync;
|
|||
|
|
ap_uint<1> HSync;
|
|||
|
|
ap_uint<8> PkRltvRdx;
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
#endif
|
|||
|
|
#endif
|