Commit bd04c118 authored by Andrey Filippov's avatar Andrey Filippov

changing WOI to variables

parent 36abc57d
This diff is collapsed.
...@@ -51,7 +51,12 @@ __global__ void convert_correct_tiles( ...@@ -51,7 +51,12 @@ __global__ void convert_correct_tiles(
float ** gpu_clt, // [NUM_CAMS][TILESY][TILESX][NUM_COLORS][DTT_SIZE*DTT_SIZE] float ** gpu_clt, // [NUM_CAMS][TILESY][TILESX][NUM_COLORS][DTT_SIZE*DTT_SIZE]
size_t dstride, // in floats (pixels) size_t dstride, // in floats (pixels)
int num_tiles, // number of tiles in task int num_tiles, // number of tiles in task
int lpf_mask); // apply lpf to colors : bit 0 - red, bit 1 - blue, bit2 - green. Now - always 0 ! int lpf_mask, // apply lpf to colors : bit 0 - red, bit 1 - blue, bit2 - green. Now - always 0 !
int woi_width,
int woi_height,
int kernels_hor,
int kernels_vert);
extern "C" __global__ void clear_texture_list( extern "C" __global__ void clear_texture_list(
int * gpu_texture_indices,// packed tile + bits (now only (1 << 7) int * gpu_texture_indices,// packed tile + bits (now only (1 << 7)
...@@ -112,6 +117,8 @@ extern "C" __global__ void imclt_rbg( ...@@ -112,6 +117,8 @@ extern "C" __global__ void imclt_rbg(
int color, // defines location of clt data int color, // defines location of clt data
int v_offset, int v_offset,
int h_offset, int h_offset,
int woi_twidth,
int woi_theight,
const size_t dstride); // in floats (pixels) const size_t dstride); // in floats (pixels)
extern "C" extern "C"
......
...@@ -114,9 +114,9 @@ struct gc { ...@@ -114,9 +114,9 @@ struct gc {
float distortionA7; //r^7 (normalized to focal length or to sensor half width?) float distortionA7; //r^7 (normalized to focal length or to sensor half width?)
float distortionA8; //r^8 (normalized to focal length or to sensor half width?) float distortionA8; //r^8 (normalized to focal length or to sensor half width?)
#ifndef NVRTC_BUG #ifndef NVRTC_BUG
// }; };
// float rad_coeff [7]; float rad_coeff [7];
// }; };
#endif #endif
// parameters, common for all sensors // parameters, common for all sensors
float elevation; // degrees, up - positive; float elevation; // degrees, up - positive;
......
...@@ -333,9 +333,7 @@ int main(int argc, char **argv) ...@@ -333,9 +333,7 @@ int main(int argc, char **argv)
float tile_coords_h [NUM_CAMS][TILESX * TILESY][2]; float tile_coords_h [NUM_CAMS][TILESX * TILESY][2];
float * gpu_clt_h [NUM_CAMS]; float * gpu_clt_h [NUM_CAMS];
float * gpu_lpf_h [NUM_COLORS]; // never used float * gpu_lpf_h [NUM_COLORS]; // never used
#ifndef NOICLT
float * gpu_corr_images_h [NUM_CAMS]; float * gpu_corr_images_h [NUM_CAMS];
#endif
float * gpu_corrs; float * gpu_corrs;
int * gpu_corr_indices; int * gpu_corr_indices;
...@@ -353,8 +351,9 @@ int main(int argc, char **argv) ...@@ -353,8 +351,9 @@ int main(int argc, char **argv)
float ** gpu_kernels; // [NUM_CAMS]; float ** gpu_kernels; // [NUM_CAMS];
struct CltExtra ** gpu_kernel_offsets; // [NUM_CAMS]; struct CltExtra ** gpu_kernel_offsets; // [NUM_CAMS];
float ** gpu_images; // [NUM_CAMS]; float ** gpu_images; // [NUM_CAMS];
float ** gpu_clt; // [NUM_CAMS]; float ** gpu_clt; // [NUM_CAMS];
float ** gpu_lpf; // [NUM_CAMS]; // never referenced float ** gpu_corr_images; // [NUM_CAMS];
float ** gpu_lpf; // [NUM_CAMS]; // never referenced
// GPU pointers to GPU memory // GPU pointers to GPU memory
// float * gpu_tasks; // float * gpu_tasks;
...@@ -433,12 +432,10 @@ int main(int argc, char **argv) ...@@ -433,12 +432,10 @@ int main(int argc, char **argv)
// Image is extended by 4 pixels each side to avoid checking (mclt tiles extend by 4) // Image is extended by 4 pixels each side to avoid checking (mclt tiles extend by 4)
//host array of pointers to GPU arrays //host array of pointers to GPU arrays
#ifndef NOICLT
gpu_corr_images_h[ncam] = alloc_image_gpu( gpu_corr_images_h[ncam] = alloc_image_gpu(
&dstride_rslt, // size_t* dstride, // in bytes!! &dstride_rslt, // size_t* dstride, // in bytes!!
IMG_WIDTH + DTT_SIZE, // int width, IMG_WIDTH + DTT_SIZE, // int width,
3*(IMG_HEIGHT + DTT_SIZE)); // int height); 3*(IMG_HEIGHT + DTT_SIZE)); // int height);
#endif
} }
// allocates one correlation kernel per line (15x15 floats), number of rows - number of tiles * number of pairs // allocates one correlation kernel per line (15x15 floats), number of rows - number of tiles * number of pairs
gpu_corrs = alloc_image_gpu( gpu_corrs = alloc_image_gpu(
...@@ -579,7 +576,7 @@ int main(int argc, char **argv) ...@@ -579,7 +576,7 @@ int main(int argc, char **argv)
gpu_kernel_offsets = (struct CltExtra **) copyalloc_pointers_gpu ((float **) gpu_kernel_offsets_h, NUM_CAMS); gpu_kernel_offsets = (struct CltExtra **) copyalloc_pointers_gpu ((float **) gpu_kernel_offsets_h, NUM_CAMS);
gpu_images = copyalloc_pointers_gpu (gpu_images_h, NUM_CAMS); gpu_images = copyalloc_pointers_gpu (gpu_images_h, NUM_CAMS);
gpu_clt = copyalloc_pointers_gpu (gpu_clt_h, NUM_CAMS); gpu_clt = copyalloc_pointers_gpu (gpu_clt_h, NUM_CAMS);
// gpu_corr_images = copyalloc_pointers_gpu (gpu_corr_images_h, NUM_CAMS); gpu_corr_images = copyalloc_pointers_gpu (gpu_corr_images_h, NUM_CAMS);
#ifdef DBG_TILE #ifdef DBG_TILE
...@@ -765,16 +762,18 @@ int main(int argc, char **argv) ...@@ -765,16 +762,18 @@ int main(int argc, char **argv)
} }
convert_correct_tiles<<<grid_tp,threads_tp>>>( convert_correct_tiles<<<grid_tp,threads_tp>>>(
fgpu_kernel_offsets, // struct CltExtra ** gpu_kernel_offsets, fgpu_kernel_offsets, // struct CltExtra ** gpu_kernel_offsets,
gpu_kernels, // float ** gpu_kernels, gpu_kernels, // float ** gpu_kernels,
gpu_images, // float ** gpu_images, gpu_images, // float ** gpu_images,
gpu_tasks, // struct tp_task * gpu_tasks, gpu_tasks, // struct tp_task * gpu_tasks,
gpu_clt, // float ** gpu_clt, // [NUM_CAMS][TILESY][TILESX][NUM_COLORS][DTT_SIZE*DTT_SIZE] gpu_clt, // float ** gpu_clt, // [NUM_CAMS][TILESY][TILESX][NUM_COLORS][DTT_SIZE*DTT_SIZE]
dstride/sizeof(float), // size_t dstride, // for gpu_images dstride/sizeof(float), // size_t dstride, // for gpu_images
tp_task_size, // int num_tiles) // number of tiles in task tp_task_size, // int num_tiles) // number of tiles in task
0); // 7); // 0); // 7); // int lpf_mask) // apply lpf to colors : bit 0 - red, bit 1 - blue, bit2 - green 0, // int lpf_mask) // apply lpf to colors : bit 0 - red, bit 1 - blue, bit2 - green
IMG_WIDTH, // int woi_width,
IMG_HEIGHT, // int woi_height,
KERNELS_HOR, // int kernels_hor,
KERNELS_VERT); // int kernels_vert);
getLastCudaError("Kernel execution failed"); getLastCudaError("Kernel execution failed");
checkCudaErrors(cudaDeviceSynchronize()); checkCudaErrors(cudaDeviceSynchronize());
printf("%d\n",i); printf("%d\n",i);
...@@ -823,7 +822,6 @@ int main(int argc, char **argv) ...@@ -823,7 +822,6 @@ int main(int argc, char **argv)
#endif #endif
#ifndef NOICLT
// testing imclt // testing imclt
dim3 threads_imclt(IMCLT_THREADS_PER_TILE, IMCLT_TILES_PER_BLOCK, 1); dim3 threads_imclt(IMCLT_THREADS_PER_TILE, IMCLT_TILES_PER_BLOCK, 1);
printf("threads_imclt=(%d, %d, %d)\n",threads_imclt.x,threads_imclt.y,threads_imclt.z); printf("threads_imclt=(%d, %d, %d)\n",threads_imclt.x,threads_imclt.y,threads_imclt.z);
...@@ -841,13 +839,8 @@ int main(int argc, char **argv) ...@@ -841,13 +839,8 @@ int main(int argc, char **argv)
for (int ncam = 0; ncam < NUM_CAMS; ncam++) { for (int ncam = 0; ncam < NUM_CAMS; ncam++) {
for (int color = 0; color < NUM_COLORS; color++) { for (int color = 0; color < NUM_COLORS; color++) {
#ifdef IMCLT14 for (int v_offs = 0; v_offs < 2; v_offs++){
for (int v_offs = 0; v_offs < 1; v_offs++){ // temporarily for debugging for (int h_offs = 0; h_offs < 2; h_offs++){
for (int h_offs = 0; h_offs < 1; h_offs++){ // temporarily for debugging
#else
for (int v_offs = 0; v_offs < 2; v_offs++){
for (int h_offs = 0; h_offs < 2; h_offs++){
#endif
int tilesy_half = (TILESY + (v_offs ^ 1)) >> 1; int tilesy_half = (TILESY + (v_offs ^ 1)) >> 1;
int tilesx_half = (TILESX + (h_offs ^ 1)) >> 1; int tilesx_half = (TILESX + (h_offs ^ 1)) >> 1;
int tiles_in_pass = tilesy_half * tilesx_half; int tiles_in_pass = tilesy_half * tilesx_half;
...@@ -857,10 +850,12 @@ int main(int argc, char **argv) ...@@ -857,10 +850,12 @@ int main(int argc, char **argv)
gpu_clt_h[ncam], // float * gpu_clt, // [TILESY][TILESX][NUM_COLORS][DTT_SIZE*DTT_SIZE] gpu_clt_h[ncam], // float * gpu_clt, // [TILESY][TILESX][NUM_COLORS][DTT_SIZE*DTT_SIZE]
gpu_corr_images_h[ncam], // float * gpu_rbg, // WIDTH, 3 * HEIGHT gpu_corr_images_h[ncam], // float * gpu_rbg, // WIDTH, 3 * HEIGHT
1, // int apply_lpf, 1, // int apply_lpf,
0, // int mono, // defines lpf filter NUM_COLORS, // int colors, // defines lpf filter
color, // int color, // defines location of clt data color, // int color, // defines location of clt data
v_offs, // int v_offset, v_offs, // int v_offset,
h_offs, // int h_offset, h_offs, // int h_offset,
TILESX, // int woi_twidth,
TILESY, // int woi_theight,
dstride_rslt/sizeof(float)); //const size_t dstride); // in floats (pixels) dstride_rslt/sizeof(float)); //const size_t dstride); // in floats (pixels)
} }
} }
...@@ -901,7 +896,6 @@ int main(int argc, char **argv) ...@@ -901,7 +896,6 @@ int main(int argc, char **argv)
} }
free(cpu_corr_image); free(cpu_corr_image);
#endif
#ifndef NOCORR #ifndef NOCORR
...@@ -1269,16 +1263,14 @@ int main(int argc, char **argv) ...@@ -1269,16 +1263,14 @@ int main(int argc, char **argv)
checkCudaErrors(cudaFree(gpu_kernel_offsets_h[ncam])); checkCudaErrors(cudaFree(gpu_kernel_offsets_h[ncam]));
checkCudaErrors(cudaFree(gpu_images_h[ncam])); checkCudaErrors(cudaFree(gpu_images_h[ncam]));
checkCudaErrors(cudaFree(gpu_clt_h[ncam])); checkCudaErrors(cudaFree(gpu_clt_h[ncam]));
#ifndef NOICLT
checkCudaErrors(cudaFree(gpu_corr_images_h[ncam])); checkCudaErrors(cudaFree(gpu_corr_images_h[ncam]));
#endif
} }
checkCudaErrors(cudaFree(gpu_tasks)); checkCudaErrors(cudaFree(gpu_tasks));
checkCudaErrors(cudaFree(gpu_kernels)); checkCudaErrors(cudaFree(gpu_kernels));
checkCudaErrors(cudaFree(gpu_kernel_offsets)); checkCudaErrors(cudaFree(gpu_kernel_offsets));
checkCudaErrors(cudaFree(gpu_images)); checkCudaErrors(cudaFree(gpu_images));
checkCudaErrors(cudaFree(gpu_clt)); checkCudaErrors(cudaFree(gpu_clt));
// checkCudaErrors(cudaFree(gpu_corr_images)); checkCudaErrors(cudaFree(gpu_corr_images));
checkCudaErrors(cudaFree(gpu_corrs)); checkCudaErrors(cudaFree(gpu_corrs));
checkCudaErrors(cudaFree(gpu_corr_indices)); checkCudaErrors(cudaFree(gpu_corr_indices));
checkCudaErrors(cudaFree(gpu_texture_indices)); checkCudaErrors(cudaFree(gpu_texture_indices));
......
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