Commit 13ca3625 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

implemented testTextures, testTexturesRGBA

parent 3610b7a6
Loading
Loading
Loading
Loading
+846 −146

File changed.

Preview size limit exceeded, changes collapsed.

+28 −2
Original line number Diff line number Diff line
@@ -130,11 +130,14 @@ public:
	void testImcltRbgAll         (int num_runs); // 701

	void testCorrelate2DIntra    (int num_runs); // 762 - 885
	void testCorrelate2DInterSelf(int num_runs); // 1136 - 1411
	void testCorrelate2DIntraTD  (int num_runs, int quad_combine); // 886 - 1123
	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


private:
	void saveClt(const char ** paths,  const char * prompt, float **     gpu_clt_h);
	void saveRgb(const char ** paths,  const char * prompt, float **     gpu_corr_images_h);

@@ -144,9 +147,32 @@ public:
	void saveInterCorrFile(const char * path, const char * prompt, int num_corrs, int num_corr_indices, float  * gpu_corrs_td,  int * gpu_corr_indices, int num_sel_sensors);
	void saveInterCorrIndicesFile(const char * path, const char * prompt, int num_corr_indices, int * gpu_corr_indices, int num_sel_sensors);

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(
			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

	void hfree(float * p); // {if (p) free (p);}
	void hfree(struct CltExtra * p);
	void gfree(float * p);
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ public:
	static constexpr int tp_task_xy_offset =        TP_TASK_XY_OFFSET;//        6
	static constexpr float fat_zero =               1000.0f; // 300.0f; // 30.0;

    static constexpr int convert_direct_indexing_threads =      CONVERT_DIRECT_INDEXING_THREADS; //
    static constexpr int convert_direct_indexing_threads_log2 = CONVERT_DIRECT_INDEXING_THREADS_LOG2; //

#ifdef DBG_TILE
	static constexpr int debug_tile{1};
	static constexpr int dbg_tile{DBG_TILE};
+9 −7
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@
// all of the next 5 were disabled
//#define NOCORR
//#define NOCORR_TD
#define NOTEXTURES //
//#define NOTEXTURES //
#define NOTEXTURE_RGBA //
//#define NOTEXTURE_RGBAXXX //

@@ -1446,7 +1446,7 @@ int main(int argc, char **argv)
    		    			tpParams.num_cams,         // int                num_cams,     // actual number of cameras
							tpParams.texture_colors,   // int                num_colors,   // actual number of colors: 3 for RGB, 1 for LWIR/mono
							0);           // int *              offsets);     // in floats
    				printf("\n1. shared_size=%d, num_cams=%d, colors=%d\n",shared_size, tpParams.num_cams, texture_colors);
    				printf("\n1. shared_size=%d, num_cams=%d, colors=%d\n",shared_size, tpParams.num_cams, tpParams.texture_colors);
    				//*pnum_texture_tiles = 0;
    				cpu_pnum_texture_tiles = 0;
    				checkCudaErrors(cudaMemcpy(
@@ -1653,9 +1653,9 @@ int main(int argc, char **argv)
    		    				printf(" ");
    		    			}
    		    		}
    		#endif // DEBUG9
    		#endif // DEBUG10
#endif //#ifdef 	DBG_TILE
    		#endif
    		#endif // #ifndef NSAVE_TEXTURES
    		    		free(cpu_textures);
    		    		free (cpu_diff_rgb_combo);
    		    		free (cpu_diff_rgb_combo_out);
@@ -1664,6 +1664,8 @@ int main(int argc, char **argv)
#endif //NOTEXTURES




#ifndef NOTEXTURE_RGBAXXX
    dim3 threads_rgba(1, 1, 1);
    dim3 grid_rgba(1,1,1);
@@ -1805,7 +1807,7 @@ int main(int argc, char **argv)
#endif // DEBUG11
#endif //#ifdef 	DBG_TILE
    free(cpu_textures_rgba);
#endif // ifndef NOTEXTURES
#endif // ifndef NOTEXTURE_RGBAXXX