Commit 32ed475a authored by Andrey Filippov's avatar Andrey Filippov

testing refactored

parent b469db50
This diff is collapsed.
......@@ -111,18 +111,27 @@ public:
,m_host_kern_buf{(float *) malloc(tpParams.kern_size * sizeof(float))}
{};
~TpHostGpu();
void setImageKernels();
void setCltBuffers();
void setCorrImgBuffers();
void setImgBuffers();
void setImgBuffersShifted(int is_bayer, int image_dx, int image_dy);
void setGeometryCorrectionBuffers();
void setCorrelationBuffers();
void setTasks(const float target_disparity, const float scale);
void setTextures();
void setRGBA();
trot_deriv testRotMatrices (int num_runs); // 424
void allTests(
int num_runs,
int image_dx, // 2
int image_dy, // 0
const float target_disparity, // DBG_DISPARITY == 0.0
const float scale, // 0.0
int quad_combine,
int use_dp,
int debug);
void setImageKernels(); // 233-258 (overlap)
void setCltBuffers(); // 246
void setCorrImgBuffers(); // 252
void setImgBuffers(); // 283-292
void setImgBuffersShifted(int is_bayer, int image_dx, int image_dy); // 1171-1188 SHOULD be called before testCorrelate2DInterSelf
void setGeometryCorrectionBuffers(); // 207-231
void setCorrelationBuffers(); // 260-281 , 332-333
void setTasks(const float target_disparity, const float scale); // 129, 302-325
void setTextures(); // 337-348, ??
void setRGBA(); // 377 - 390
trot_deriv testRotMatrices (int num_runs); // 420
void testReverseDistortions (int num_runs); // 468
void testGeomCorrect (int num_runs); // 534
void testConvertDirect (int num_runs); // 608
......@@ -131,8 +140,8 @@ public:
void testCorrelate2DIntra (int num_runs); // 762 - 885
void testCorrelate2DIntraTD (int num_runs, int quad_combine); // 886 - 1123
//void setImgBuffersShifted(int is_bayer, int image_dx, int image_dy); // 1171-1188
void testCorrelate2DInterSelf(int num_runs); // 1136 - 1411
void testTextures (int num_runs, int use_dp, int debug); // 1422-1664
void testTexturesRGBA (int num_runs, int use_dp, int debug); // 1669-1810
......@@ -149,7 +158,7 @@ private:
float * getCorrImg (int corr_img_size, int num_corr_indices, int * cpu_corr_indices, float * cpu_corr, int num_sel_sensors);
float * getCorrTdImg(int corr_img_size, int num_corr_indices, int * cpu_corr_indices, float * cpu_corr_td, int num_sel_sensors);
void generate_RBGA_host(
void generate_RBGA_host( // not a member
int num_cams, // number of cameras used
// Parameters to generate texture tasks
float * gpu_ftasks, // flattened tasks, 27 floats for quad EO, 99 floats for LWIR16p// struct tp_task * gpu_tasks,
......@@ -183,6 +192,7 @@ private:
void gfree(struct corr_vector * p);
void gfree(struct trot_deriv * p);
void gfree(float ** p);
void gfree(struct CltExtra ** p);
};
......
......@@ -97,8 +97,6 @@
*
* \return Status code
*/
int main(int argc, char **argv)
{
//
......@@ -106,41 +104,40 @@ int main(int argc, char **argv)
//
printf("%s Starting...\n\n", argv[0]);
printf("sizeof(float*)=%d\n",(int)sizeof(float*));
//initialize CUDA
findCudaDevice(argc, (const char **)argv);
float fat_zero = 1000.0f; // 300.0f; // 30.0;
int is_bayer = 0; // from 1136
int image_dx = 2;
int image_dy = 0;
#if TEST_LWIR
int use_lwir= 1;
#else
int use_lwir= 0;
#endif
class YourClass
{
std::vector<int> myVector;
// ...
};
TpParams tpParams(use_lwir);
TpPaths tpPaths(use_lwir);
TpHostGpu tpHostGpu(tpParams,tpPaths);
GenerateRgbaHost generateRgbaHost{}; // = new GenerateRgbaHost();
/* */
tpHostGpu.allTests(
10, // int num_runs,
2, // int image_dx, // 2
0, // int image_dy, // 0
0.0, // const float target_disparity, // DBG_DISPARITY == 0.0
0.0, // const float scale, // 0.0
0, // int quad_combine,
0, // int use_dp,
0); // int debug);
return 0;
/* */
GenerateRgbaHost generateRgbaHost{}; // = new GenerateRgbaHost(); Remove files, use tpHostGpu::
// return 0;
float * host_kern_buf = (float *) malloc(tpParams.kern_size * sizeof(float));
float * ftask_data = (float *) malloc(TILESX * TILESY * tpParams.task_size * sizeof(float));
float * ftask_data1 = (float *) malloc(TILESX * TILESY * tpParams.task_size * sizeof(float));
trot_deriv rot_deriv;
int texture_indices [TILESX*TILESYA];
int cpu_woi [4];
// host array of pointers to GPU memory
float * gpu_kernels_h [tpParams.num_cams];
struct CltExtra * gpu_kernel_offsets_h [tpParams.num_cams];
......@@ -148,14 +145,12 @@ int main(int argc, char **argv)
float tile_coords_h [tpParams.num_cams][TILESX * TILESY][2];
float * gpu_clt_h [tpParams.num_cams];
float * gpu_corr_images_h [tpParams.num_cams];
float * gpu_corrs; // correlation tiles (per tile, per pair) in pixel domain
float * gpu_corrs_td; // correlation tiles (per tile, per pair) in transform domain
int * gpu_corr_indices; // shared by gpu_corrs gpu_corrs_td
float * gpu_corrs_combo; // correlation tiles combined (1 per tile), pixel domain
float * gpu_corrs_combo_td; // correlation tiles combined (1 per tile), transform domain
int * gpu_corrs_combo_indices; // shared by gpu_corrs_combo and gpu_corrs_combo_td
float * gpu_textures;
float * gpu_diff_rgb_combo;
float * gpu_textures_rbga;
......@@ -176,7 +171,6 @@ int main(int argc, char **argv)
float ** gpu_corr_images; // [NUM_CAMS];
// GPU pointers to GPU memory
float * gpu_ftasks; // TODO: ***** allocate ! **** DONE
int * gpu_active_tiles;
......@@ -344,7 +338,7 @@ int main(int argc, char **argv)
for (int tx = 0; tx < TILESX; tx++){
int nt = ty * TILESX + tx;
float *tp = ftask_data + tpParams.task_size * nt;
int cm = (*(int *) tp) & TASK_TEXTURE_BITS; // non-zero any of 4 lower task bits
int cm = (*(int *) tp) & (TASK_TEXTURE_BITS | (1 << TASK_TEXT_EN)); // non-zero any of 8 lower task bits or bit 8 (TASK_TEXT_EN)
if (cm){
texture_indices[num_textures++] = (nt << TEXT_NTILE_SHIFT) | (1 << LIST_TEXTURE_BIT); // setting 0x80 in texture indices
}
......@@ -640,7 +634,7 @@ int main(int argc, char **argv)
IMG_HEIGHT, // int woi_height,
0, // KERNELS_HOR, // int kernels_hor,
KERNELS_VERT, // int kernels_vert);
gpu_active_tiles, // int * gpu_active_tiles, // pointer to the calculated number of non-zero tiles
gpu_active_tiles, // int * gpu_active_tiles, // pointer to the calculated list of tiles
gpu_num_active, //); // int * pnum_active_tiles); // indices to gpu_tasks
TILESX); // int tilesx)
printf("HOST: convert_direct() done\n");
......@@ -1138,9 +1132,9 @@ int main(int argc, char **argv)
int num_sel_sensors = 16; // 15; // 16;
int num_pairs_inter = num_sel_sensors+1;
num_corr_indices = num_pairs_inter * num_tiles;
int is_bayer = 0;
int image_dx = 2;
int image_dy = 0;
// int is_bayer = 0;
// int image_dx = 2;
// int image_dy = 0;
float * gpu_clt_ref_h [tpParams.num_cams];
float ** gpu_clt_ref; // [NUM_CAMS];
......@@ -1166,7 +1160,7 @@ int main(int argc, char **argv)
IMG_HEIGHT, // int woi_height,
KERNELS_HOR, // int kernels_hor,
KERNELS_VERT, // int kernels_vert);
gpu_active_tiles, // int * gpu_active_tiles, // pointer to the calculated number of non-zero tiles
gpu_active_tiles, // int * gpu_active_tiles, // pointer to the calculated list of tiles
gpu_num_active, //); // int * pnum_active_tiles); // indices to gpu_tasks
TILESX); // int tilesx)
......@@ -1208,7 +1202,7 @@ int main(int argc, char **argv)
IMG_HEIGHT, // int woi_height,
KERNELS_HOR, // int kernels_hor,
KERNELS_VERT, // int kernels_vert);
gpu_active_tiles, // int * gpu_active_tiles, // pointer to the calculated number of non-zero tiles
gpu_active_tiles, // int * gpu_active_tiles, // pointer to the calculated list of tiles
gpu_num_active, //); // int * pnum_active_tiles); // indices to gpu_tasks
TILESX); // int tilesx)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment