Commit 46256d14 authored by Andrey Filippov's avatar Andrey Filippov

GenerateRgbaHost - from class instance

parent 1bf5e8bf
This diff is collapsed.
#ifndef GENERATE_RGBA_HOST_H_
#define GENERATE_RGBA_HOST_H_
class GenerateRgbaHost {
public:
GenerateRgbaHost();
~GenerateRgbaHost();
void generate_RBGA_host(
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,
int num_tiles, // number of tiles in task list
// declare arrays in device code?
int * gpu_texture_indices,// packed tile + bits (now only (1 << 7)
int * gpu_num_texture_tiles, // number of texture tiles to process (8 separate elements for accumulation)
int * gpu_woi, // x,y,width,height of the woi
int width, // <= TILES-X, use for faster processing of LWIR images (should be actual + 1)
int height, // <= TILES-Y, use for faster processing of LWIR images
// Parameters for the texture generation
float ** gpu_clt, // [num_cams] ->[TILES-Y][TILES-X][colors][DTT_SIZE*DTT_SIZE]
// TODO: use geometry_correction rXY !
struct gc * gpu_geometry_correction,
int colors, // number of colors (3/1)
int is_lwir, // do not perform shot correction
const float cpu_params[5], // mitigating CUDA_ERROR_INVALID_PTX
const float weights[3], // scale for R,B,G should be host_array, not gpu
int dust_remove, // Do not reduce average weight when only one image differs much from the average
int keep_weights, // return channel weights after A in RGBA (was removed) (should be 0 if gpu_texture_rbg)?
const int texture_rbga_stride, // in floats
float * gpu_texture_tiles); // (number of colors +1 + ?)*16*16 rgba texture tiles
};
#endif
...@@ -65,7 +65,8 @@ ...@@ -65,7 +65,8 @@
#include "tp_files.h" #include "tp_files.h"
//#include "tp_paths.cuh" //#include "tp_paths.cuh"
#include "tp_paths.h" #include "tp_paths.h"
#include "GenerateRgbaHost.h"
/*
#if TEST_LWIR #if TEST_LWIR
#define IMG_WIDTH 640 #define IMG_WIDTH 640
#define IMG_HEIGHT 512 #define IMG_HEIGHT 512
...@@ -83,9 +84,9 @@ ...@@ -83,9 +84,9 @@
#define TILESX (IMG_WIDTH / DTT_SIZE) #define TILESX (IMG_WIDTH / DTT_SIZE)
#define TILESY (IMG_HEIGHT / DTT_SIZE) #define TILESY (IMG_HEIGHT / DTT_SIZE)
#define TILESYA ((TILESY +3) & (~3)) #define TILESYA ((TILESY +3) & (~3))
*/
#include "generate_RGBA_host.inc" //#include "generate_RGBA_host.inc"
#if 0
void generate_RBGA_host( void generate_RBGA_host(
int num_cams, // number of cameras used int num_cams, // number of cameras used
// Parameters to generate texture tasks // Parameters to generate texture tasks
...@@ -359,7 +360,7 @@ void generate_RBGA_host( ...@@ -359,7 +360,7 @@ void generate_RBGA_host(
// checkCudaErrors(cudaFree(gpu_num_texture_tiles)); // checkCudaErrors(cudaFree(gpu_num_texture_tiles));
// __syncthreads(); // __syncthreads();
} }
#endif // 0
/** /**
...@@ -392,6 +393,7 @@ int main(int argc, char **argv) ...@@ -392,6 +393,7 @@ int main(int argc, char **argv)
#endif #endif
TpPaths tpPaths(use_lwir); TpPaths tpPaths(use_lwir);
GenerateRgbaHost generateRgbaHost{}; // = new GenerateRgbaHost();
#if TEST_LWIR #if TEST_LWIR
...@@ -474,22 +476,13 @@ int main(int argc, char **argv) ...@@ -474,22 +476,13 @@ int main(int argc, char **argv)
int KERN_TILES = KERNELS_HOR * KERNELS_VERT * num_colors; // NUM_COLORS; int KERN_TILES = KERNELS_HOR * KERNELS_VERT * num_colors; // NUM_COLORS;
int KERN_SIZE = KERN_TILES * 4 * 64; int KERN_SIZE = KERN_TILES * 4 * 64;
int CORR_SIZE = (2 * CORR_OUT_RAD + 1) * (2 * CORR_OUT_RAD + 1); int CORR_SIZE = (2 * CORR_OUT_RAD + 1) * (2 * CORR_OUT_RAD + 1);
float * host_kern_buf = (float *)malloc(KERN_SIZE * sizeof(float)); float * host_kern_buf = (float *)malloc(KERN_SIZE * sizeof(float));
// static - see https://stackoverflow.com/questions/20253267/segmentation-fault-before-main
/// static struct tp_task task_data [TILESX*TILESY]; // maximal length - each tile
/// static struct tp_task task_data1 [TILESX*TILESY]; // maximal length - each tile
float * ftask_data = (float *) malloc(TILESX * TILESY * task_size * sizeof(float)); float * ftask_data = (float *) malloc(TILESX * TILESY * task_size * sizeof(float));
float * ftask_data1 = (float *) malloc(TILESX * TILESY * task_size * sizeof(float)); float * ftask_data1 = (float *) malloc(TILESX * TILESY * task_size * sizeof(float));
trot_deriv rot_deriv; trot_deriv rot_deriv;
/// int corr_indices [NUM_PAIRS*TILESX*TILESY];
int texture_indices [TILESX*TILESYA]; int texture_indices [TILESX*TILESYA];
int cpu_woi [4]; int cpu_woi [4];
...@@ -521,7 +514,6 @@ int main(int argc, char **argv) ...@@ -521,7 +514,6 @@ int main(int argc, char **argv)
float * gpu_generate_RBGA_params; float * gpu_generate_RBGA_params;
int num_corrs; int num_corrs;
int num_textures; int num_textures;
/// int num_ports = NUM_CAMS;
// GPU pointers to GPU pointers to memory // GPU pointers to GPU pointers to memory
float ** gpu_kernels; // [NUM_CAMS]; float ** gpu_kernels; // [NUM_CAMS];
struct CltExtra ** gpu_kernel_offsets; // [NUM_CAMS]; struct CltExtra ** gpu_kernel_offsets; // [NUM_CAMS];
...@@ -532,7 +524,6 @@ int main(int argc, char **argv) ...@@ -532,7 +524,6 @@ int main(int argc, char **argv)
// GPU pointers to GPU memory // GPU pointers to GPU memory
/// struct tp_task * gpu_tasks; // TODO: ***** remove ! **** DONE
float * gpu_ftasks; // TODO: ***** allocate ! **** DONE float * gpu_ftasks; // TODO: ***** allocate ! **** DONE
int * gpu_active_tiles; int * gpu_active_tiles;
int * gpu_num_active; int * gpu_num_active;
...@@ -554,6 +545,7 @@ int main(int argc, char **argv) ...@@ -554,6 +545,7 @@ int main(int argc, char **argv)
size_t dstride_textures_rbga; // in bytes ! for one rgba/ya 16x16 tile size_t dstride_textures_rbga; // in bytes ! for one rgba/ya 16x16 tile
struct gc fgeometry_correction; struct gc fgeometry_correction;
float* correction_vector; float* correction_vector;
int correction_vector_length; int correction_vector_length;
float * rByRDist; float * rByRDist;
...@@ -2044,7 +2036,7 @@ int main(int argc, char **argv) ...@@ -2044,7 +2036,7 @@ int main(int argc, char **argv)
} }
// FIXME: update to use new correlations and num_cams // FIXME: update to use new correlations and num_cams
#ifdef NO_DP #ifdef NO_DP
generate_RBGA_host ( generateRgbaHost.generate_RBGA_host (
num_cams, // int num_cams, // number of cameras used num_cams, // int num_cams, // number of cameras used
// Parameters to generate texture tasks // Parameters to generate texture tasks
gpu_ftasks, // float * gpu_ftasks, // flattened tasks, 27 floats for quad EO, 99 floats for LWIR16 gpu_ftasks, // float * gpu_ftasks, // flattened tasks, 27 floats for quad EO, 99 floats for LWIR16
...@@ -2222,6 +2214,7 @@ int main(int argc, char **argv) ...@@ -2222,6 +2214,7 @@ int main(int argc, char **argv)
free (correction_vector); free (correction_vector);
free (ftask_data); free (ftask_data);
free (ftask_data1); free (ftask_data1);
// delete generateRgbaHost;
exit(0); exit(0);
} }
...@@ -155,6 +155,25 @@ ...@@ -155,6 +155,25 @@
#endif //#ifdef DEBUG_ANY #endif //#ifdef DEBUG_ANY
#if TEST_LWIR
#define IMG_WIDTH 640
#define IMG_HEIGHT 512
#define KERNELS_HOR 82 // 80+2
#define KERNELS_VERT 66 // 64+2
#else
#define IMG_WIDTH 2592
#define IMG_HEIGHT 1936
#define KERNELS_HOR 164 // 2592 / 16 + 2
#define KERNELS_VERT 123 // 1936 / 16 + 2
#endif
#define CORR_OUT_RAD 7 // full tile (15x15), was 4 (9x9)
#define DBG_DISPARITY 0.0 // 56.0// 0.0 // 56.0 // disparity for which to calculate offsets (not needed in Java)
// only used in C++ test
#define TILESX (IMG_WIDTH / DTT_SIZE)
#define TILESY (IMG_HEIGHT / DTT_SIZE)
#define TILESYA ((TILESY +3) & (~3))
#endif //#ifndef JCUDA #endif //#ifndef JCUDA
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