147 lines
3.3 KiB
C++
147 lines
3.3 KiB
C++
|
||
#ifndef TB_GLOBALS_H
|
||
#define TB_GLOBALS_H
|
||
|
||
#include "../globals/algoGlobals.h"
|
||
#include <vector>
|
||
#include <cmath>
|
||
#include <algorithm>
|
||
#include <cstring>
|
||
#include <iostream>
|
||
#include <fstream>
|
||
|
||
#define TB_PATH_MAX 1024
|
||
|
||
typedef struct
|
||
{
|
||
uint16_t left_L;
|
||
uint16_t right_L;
|
||
uint16_t left_T;
|
||
uint16_t right_T;
|
||
uint16_t W;
|
||
uint16_t H;
|
||
uint32_t FrmNo;
|
||
uint32_t TimeStamp;
|
||
uint32_t encInfo;
|
||
float u0;
|
||
float v0;
|
||
float F;
|
||
float baseLen;
|
||
}Luma_frameInfo;
|
||
|
||
typedef struct
|
||
{
|
||
uint16_t WinRdx;//窗口在图像内的起始坐标
|
||
uint16_t y; //y坐标
|
||
uint16_t Rid; //region的ID
|
||
uint8_t Flag; //bit0是overlap标志。bit1是反光信号标志
|
||
uint8_t PeakRltvRdx; //peak在窗口内的的相对坐标,低4位是起始坐标,高4位是结束坐标
|
||
uint8_t data[RGN_DATA_WIN_SIZE];
|
||
//double offset;
|
||
}Luma_rgnData;
|
||
|
||
typedef struct
|
||
{
|
||
uint16_t WinRdx;//窗口在图像内的起始坐标
|
||
uint16_t y; //y坐标
|
||
uint16_t Rid; //region的ID
|
||
uint8_t Flag; //bit0是overlap标志。bit1是反光信号标志
|
||
uint8_t pkValue;
|
||
int32_t nD1;
|
||
int32_t nD2;
|
||
}Luma_convolveData;
|
||
|
||
typedef struct
|
||
{
|
||
float x;
|
||
uint16_t y; //y坐标
|
||
uint16_t Rid; //region的ID
|
||
uint8_t Flag; //bit0是overlap标志。bit1是反光信号标
|
||
uint8_t pkValue;
|
||
uint8_t Sync;
|
||
}Luma_rgnSubpix;
|
||
|
||
typedef struct
|
||
{
|
||
float x;
|
||
float y; //y坐标
|
||
uint16_t Rid; //region的ID
|
||
uint8_t Flag; //bit0是overlap标志。bit1是反光信号标
|
||
uint8_t pkValue;
|
||
uint8_t sync;
|
||
}Luma_rgnSubpixCalib;
|
||
|
||
#pragma pack(push, 1)
|
||
typedef struct {
|
||
uint16_t file_type; // 文件类型,'BM'
|
||
uint32_t file_size; // 文件大小
|
||
uint16_t reserved1; // 保留字段
|
||
uint16_t reserved2;
|
||
uint32_t offset_data; // 数据偏移
|
||
}BMPFileHeader;
|
||
|
||
typedef struct {
|
||
uint32_t size; // 信息头大小(40字节)
|
||
int32_t width; // 图像宽度
|
||
int32_t height; // 图像高度(正数表示倒序)
|
||
uint16_t planes; // 颜色平面数(必须为1)
|
||
uint16_t bit_count; // 每像素位数(24)
|
||
uint32_t compression; // 压缩方式(0表示无压缩)
|
||
uint32_t size_image; // 像素数据大小
|
||
int32_t x_pixels_per_meter;
|
||
int32_t y_pixels_per_meter;
|
||
uint32_t colors_used;
|
||
uint32_t colors_important;
|
||
} BMPInfoHeader;
|
||
|
||
|
||
typedef struct {
|
||
const char *name; /* 组名,同时作为目录名 */
|
||
int start_id; /* 包含起始序号 */
|
||
int end_id; /* 包含结束序号 */
|
||
} TbGroup;
|
||
|
||
typedef enum {
|
||
TB_1_peakCentering = 0,
|
||
TB_2_convolve,
|
||
TB_3_subPix,
|
||
TB_4_Calib,
|
||
TB_5_lrMatch,
|
||
TB_6_SSProc,
|
||
TB_7_compute3D,
|
||
TB_MODULE_COUNT
|
||
} TbModule;
|
||
|
||
typedef struct {
|
||
char input[TB_PATH_MAX];
|
||
char paras[TB_PATH_MAX];
|
||
char output[TB_PATH_MAX];
|
||
} TbPaths;
|
||
|
||
typedef struct {
|
||
char calib_fittingMap_L[TB_PATH_MAX];
|
||
char calib_fittingMap_R[TB_PATH_MAX];
|
||
} TbFittingMapPaths;
|
||
|
||
extern const char tb_sim_root[];
|
||
extern const TbGroup tb_groups[];
|
||
extern const size_t tb_group_count;
|
||
extern const char * const tb_module_names[TB_MODULE_COUNT];
|
||
|
||
int tb_check_config(void);
|
||
int tb_get_paths(TbModule module, size_t group_index,
|
||
int file_id, int LRflag, TbPaths *paths);
|
||
|
||
/* root覆盖默认根目录,便于HLS仿真从不同工作目录启动。 */
|
||
int tb_get_paths_at(const char *root, TbModule module,
|
||
size_t group_index, int file_id, int LRflag, TbPaths *paths);
|
||
|
||
int tb_get_fittingMap_paths(TbModule module, size_t group_index, TbFittingMapPaths *paths);
|
||
|
||
Luma_frameInfo readParaFile(const char* file, int idx);
|
||
|
||
#pragma pack(pop)
|
||
|
||
|
||
#endif
|