Commit 58d01fd2 authored by Andrey Filippov's avatar Andrey Filippov

converting to multi-cam

parent 6a300e5a
...@@ -92,12 +92,36 @@ ...@@ -92,12 +92,36 @@
<artifactId>loci_tools</artifactId> <artifactId>loci_tools</artifactId>
<version>6.1.0</version> <version>6.1.0</version>
</dependency> </dependency>
<!--
<dependency> <dependency>
<groupId>com.drewnoakes</groupId> <groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId> <artifactId>metadata-extractor</artifactId>
<version>2.11.0</version> <version>2.11.0</version>
<type>java-source</type> <type>java-source</type>
</dependency> -->
<!-- https://mvnrepository.com/artifact/com.drewnoakes/metadata-extractor -->
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.11.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.ehcache/ehcache-core -->
<!--
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.6.2</version>
</dependency>\
-->
<!-- https://mvnrepository.com/artifact/org.slf4j/jcl-over-slf4j -->
<!--
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.5</version>
</dependency> </dependency>
-->
</dependencies> </dependencies>
......
...@@ -179,11 +179,14 @@ private Panel panel1, ...@@ -179,11 +179,14 @@ private Panel panel1,
public static CLTParameters CLT_PARAMETERS = new CLTParameters(); public static CLTParameters CLT_PARAMETERS = new CLTParameters();
public static EyesisDCT EYESIS_DCT = null; public static EyesisDCT EYESIS_DCT = null;
public static QuadCLT QUAD_CLT = null; public static QuadCLT QUAD_CLT = null;
public static QuadCLT QUAD_CLT_AUX = null; public static QuadCLT QUAD_CLT_AUX = null;
public static TwoQuadCLT TWO_QUAD_CLT = null; public static TwoQuadCLT TWO_QUAD_CLT = null;
public static GPUTileProcessor GPU_TILE_PROCESSOR = null; public static GPUTileProcessor GPU_TILE_PROCESSOR = null;
// Add macro for GPU_QUAD?
public static GPUTileProcessor.GpuQuad GPU_QUAD = null;
public static GPUTileProcessor.GpuQuad GPU_QUAD_AUX = null;
public static LwirReader LWIR_READER = null; public static LwirReader LWIR_READER = null;
public static EyesisCorrectionParameters.DebayerParameters DEBAYER_PARAMETERS = new EyesisCorrectionParameters.DebayerParameters( public static EyesisCorrectionParameters.DebayerParameters DEBAYER_PARAMETERS = new EyesisCorrectionParameters.DebayerParameters(
...@@ -5803,12 +5806,31 @@ private Panel panel1, ...@@ -5803,12 +5806,31 @@ private Panel panel1,
} //final int debugLevel); } //final int debugLevel);
} }
if (GPU_QUAD == null) {
try {
GPU_QUAD = GPU_TILE_PROCESSOR. new GpuQuad(
2592,
1936,
4,
3);
} catch (Exception e) {
System.out.println("Failed to initialize GpuQuad class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
}
// For now keep GPU_QUAD_AUX==null
if (COLOR_PROC_PARAMETERS_AUX == null) { if (COLOR_PROC_PARAMETERS_AUX == null) {
COLOR_PROC_PARAMETERS_AUX = COLOR_PROC_PARAMETERS.clone(); COLOR_PROC_PARAMETERS_AUX = COLOR_PROC_PARAMETERS.clone();
} }
try { try {
TWO_QUAD_CLT.processCLTQuadCorrPairsGpu( TWO_QUAD_CLT.processCLTQuadCorrPairsGpu(
GPU_TILE_PROCESSOR, // GPU_TILE_PROCESSOR,
GPU_QUAD, // GPUTileProcessor.GpuQuad gpuQuad_main,
GPU_QUAD_AUX, // GPUTileProcessor.GpuQuad gpuQuad_aux,
QUAD_CLT, // QuadCLT quadCLT_main, QUAD_CLT, // QuadCLT quadCLT_main,
QUAD_CLT_AUX, // QuadCLT quadCLT_aux, QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters, CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -452,7 +452,9 @@ public class TwoQuadCLT { ...@@ -452,7 +452,9 @@ public class TwoQuadCLT {
} }
public void processCLTQuadCorrPairsGpu( public void processCLTQuadCorrPairsGpu(
GPUTileProcessor gPUTileProcessor, // GPUTileProcessor gPUTileProcessor,
GPUTileProcessor.GpuQuad gpuQuad_main,
GPUTileProcessor.GpuQuad gpuQuad_aux,
QuadCLT quadCLT_main, QuadCLT quadCLT_main,
QuadCLT quadCLT_aux, QuadCLT quadCLT_aux,
CLTParameters clt_parameters, CLTParameters clt_parameters,
...@@ -516,7 +518,9 @@ public class TwoQuadCLT { ...@@ -516,7 +518,9 @@ public class TwoQuadCLT {
// Tempporarily processing individaully with the old code // Tempporarily processing individaully with the old code
processCLTQuadCorrPairGpu( processCLTQuadCorrPairGpu(
gPUTileProcessor, // GPUTileProcessor gPUTileProcessor, // gPUTileProcessor, // GPUTileProcessor gPUTileProcessor,
gpuQuad_main, // GPUTileProcessor.GpuQuad gpuQuad_main,
gpuQuad_aux, // GPUTileProcessor.GpuQuad gpuQuad_aux,
quadCLT_main, // QuadCLT quadCLT_main, quadCLT_main, // QuadCLT quadCLT_main,
quadCLT_aux, // QuadCLT quadCLT_aux, quadCLT_aux, // QuadCLT quadCLT_aux,
imp_srcs_main, // ImagePlus [] imp_quad_main, imp_srcs_main, // ImagePlus [] imp_quad_main,
...@@ -1934,7 +1938,9 @@ public class TwoQuadCLT { ...@@ -1934,7 +1938,9 @@ public class TwoQuadCLT {
} }
public ImagePlus [] processCLTQuadCorrPairGpu( public ImagePlus [] processCLTQuadCorrPairGpu(
GPUTileProcessor gPUTileProcessor, // GPUTileProcessor gPUTileProcessor,
GPUTileProcessor.GpuQuad gpuQuad_main,
GPUTileProcessor.GpuQuad gpuQuad_aux,
QuadCLT quadCLT_main, QuadCLT quadCLT_main,
QuadCLT quadCLT_aux, QuadCLT quadCLT_aux,
ImagePlus [] imp_quad_main, ImagePlus [] imp_quad_main,
...@@ -1980,17 +1986,17 @@ public class TwoQuadCLT { ...@@ -1980,17 +1986,17 @@ public class TwoQuadCLT {
image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_g), image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_g),
image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_m) image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_m)
}; };
gPUTileProcessor.setLpfRbg( gpuQuad_main.setLpfRbg(
lpf_rgb); lpf_rgb);
float [] lpf_flat = image_dtt.floatGetCltLpfFd(clt_parameters.getGpuCorrSigma(is_mono)); float [] lpf_flat = image_dtt.floatGetCltLpfFd(clt_parameters.getGpuCorrSigma(is_mono));
gPUTileProcessor.setLpfCorr( gpuQuad_main.setLpfCorr(
"lpf_corr", // String const_name, // "lpf_corr" "lpf_corr", // String const_name, // "lpf_corr"
lpf_flat); lpf_flat);
float [] lpf_rb_flat = image_dtt.floatGetCltLpfFd(clt_parameters.getGpuCorrRBSigma(is_mono)); float [] lpf_rb_flat = image_dtt.floatGetCltLpfFd(clt_parameters.getGpuCorrRBSigma(is_mono));
gPUTileProcessor.setLpfCorr( gpuQuad_main.setLpfCorr(
"lpf_rb_corr", // String const_name, // "lpf_corr" "lpf_rb_corr", // String const_name, // "lpf_corr"
lpf_rb_flat); lpf_rb_flat);
...@@ -2026,11 +2032,11 @@ public class TwoQuadCLT { ...@@ -2026,11 +2032,11 @@ public class TwoQuadCLT {
debugLevel); // final int debugLevel); debugLevel); // final int debugLevel);
gPUTileProcessor.setConvolutionKernels( gpuQuad_main.setConvolutionKernels(
(use_aux?quadCLT_aux.getCLTKernels() : quadCLT_main.getCLTKernels()), // double [][][][][][] clt_kernels, (use_aux?quadCLT_aux.getCLTKernels() : quadCLT_main.getCLTKernels()), // double [][][][][][] clt_kernels,
false); // boolean force) false); // boolean force)
gPUTileProcessor.setBayerImages( gpuQuad_main.setBayerImages(
(use_aux? quadCLT_aux.image_data: quadCLT_main.image_data), // double [][][] bayer_data, (use_aux? quadCLT_aux.image_data: quadCLT_main.image_data), // double [][][] bayer_data,
true); // boolean force); true); // boolean force);
...@@ -2040,7 +2046,7 @@ public class TwoQuadCLT { ...@@ -2040,7 +2046,7 @@ public class TwoQuadCLT {
clt_parameters.gpu_woi_ty, clt_parameters.gpu_woi_ty,
clt_parameters.gpu_woi_twidth, clt_parameters.gpu_woi_twidth,
clt_parameters.gpu_woi_theight); clt_parameters.gpu_woi_theight);
GPUTileProcessor.TpTask [] tp_tasks = gPUTileProcessor.setFullFrameImages( GPUTileProcessor.TpTask [] tp_tasks = gpuQuad_main.setFullFrameImages(
false, // boolean calc_offsets, // old way, now not needed with GPU calculation false, // boolean calc_offsets, // old way, now not needed with GPU calculation
twoi, // Rectangle woi, twoi, // Rectangle woi,
clt_parameters.gpu_woi_round, // boolean round_woi, clt_parameters.gpu_woi_round, // boolean round_woi,
...@@ -2096,26 +2102,14 @@ public class TwoQuadCLT { ...@@ -2096,26 +2102,14 @@ public class TwoQuadCLT {
} }
} }
gPUTileProcessor.setTasks( gpuQuad_main.setTasks(
tp_tasks, // TpTask [] tile_tasks, tp_tasks, // TpTask [] tile_tasks,
use_aux); // boolean use_aux) use_aux); // boolean use_aux)
gpuQuad_main.setGeometryCorrection(
// int [] corr_indices = gPUTileProcessor.getCorrTasks(
// tp_tasks);
// corr_indices array of integers to be passed to GPU
// gPUTileProcessor.setCorrIndices(corr_indices);
/*
int [] texture_indices = gPUTileProcessor.getTextureTasks(
tp_tasks);
gPUTileProcessor.setTextureIndices(
texture_indices);
*/
gPUTileProcessor.setGeometryCorrection(
quadCLT_main.getGeometryCorrection(), quadCLT_main.getGeometryCorrection(),
false); // boolean use_java_rByRDist) { // false - use newer GPU execCalcReverseDistortions); // once false); // boolean use_java_rByRDist) { // false - use newer GPU execCalcReverseDistortions); // once
gPUTileProcessor.setExtrinsicsVector(quadCLT_main.getGeometryCorrection().getCorrVector()); // for each new image gpuQuad_main.setExtrinsicsVector(quadCLT_main.getGeometryCorrection().getCorrVector()); // for each new image
/* // TODO: calculate from the camera geometry? /* // TODO: calculate from the camera geometry?
double[][] port_offsets = { // used only in textures to scale differences double[][] port_offsets = { // used only in textures to scale differences
...@@ -2129,33 +2123,33 @@ public class TwoQuadCLT { ...@@ -2129,33 +2123,33 @@ public class TwoQuadCLT {
System.out.println("\n------------ Running GPU "+NREPEAT+" times ----------------"); System.out.println("\n------------ Running GPU "+NREPEAT+" times ----------------");
long startGPU=System.nanoTime(); long startGPU=System.nanoTime();
for (int i = 0; i < NREPEAT; i++ ) { for (int i = 0; i < NREPEAT; i++ ) {
gPUTileProcessor.execCalcReverseDistortions(); gpuQuad_main.execCalcReverseDistortions();
} }
long startRotDerivs=System.nanoTime(); long startRotDerivs=System.nanoTime();
for (int i = 0; i < NREPEAT; i++ ) { for (int i = 0; i < NREPEAT; i++ ) {
gPUTileProcessor.execRotDerivs(); gpuQuad_main.execRotDerivs();
} }
long startTasksSetup=System.nanoTime(); long startTasksSetup=System.nanoTime();
for (int i = 0; i < NREPEAT; i++ ) { for (int i = 0; i < NREPEAT; i++ ) {
gPUTileProcessor.execSetTilesOffsets(); gpuQuad_main.execSetTilesOffsets();
} }
long startDirectConvert=System.nanoTime(); long startDirectConvert=System.nanoTime();
for (int i = 0; i < NREPEAT; i++ ) { for (int i = 0; i < NREPEAT; i++ ) {
gPUTileProcessor.execConvertDirect(); gpuQuad_main.execConvertDirect();
} }
// run imclt; // run imclt;
long startIMCLT=System.nanoTime(); long startIMCLT=System.nanoTime();
for (int i = 0; i < NREPEAT; i++ ) { for (int i = 0; i < NREPEAT; i++ ) {
gPUTileProcessor.execImcltRbgAll(quadCLT_main.isMonochrome()); gpuQuad_main.execImcltRbgAll(quadCLT_main.isMonochrome());
} }
long endImcltTime = System.nanoTime(); long endImcltTime = System.nanoTime();
// run correlation // run correlation
long startCorr2d=System.nanoTime(); // System.nanoTime(); long startCorr2d=System.nanoTime(); // System.nanoTime();
for (int i = 0; i < NREPEAT; i++ ) gPUTileProcessor.execCorr2D( for (int i = 0; i < NREPEAT; i++ ) gpuQuad_main.execCorr2D(
scales,// double [] scales, scales,// double [] scales,
fat_zero, // double fat_zero); fat_zero, // double fat_zero);
clt_parameters.gpu_corr_rad); // int corr_radius clt_parameters.gpu_corr_rad); // int corr_radius
...@@ -2163,7 +2157,7 @@ public class TwoQuadCLT { ...@@ -2163,7 +2157,7 @@ public class TwoQuadCLT {
long endCorr2d = System.nanoTime(); long endCorr2d = System.nanoTime();
// run textures // run textures
long startTextures = System.nanoTime(); // System.nanoTime(); long startTextures = System.nanoTime(); // System.nanoTime();
for (int i = 0; i < NREPEAT; i++ ) gPUTileProcessor.execTextures( for (int i = 0; i < NREPEAT; i++ ) gpuQuad_main.execTextures(
col_weights, // double [] color_weights, col_weights, // double [] color_weights,
quadCLT_main.isLwir(), // boolean is_lwir, quadCLT_main.isLwir(), // boolean is_lwir,
clt_parameters.min_shot, // double min_shot, // 10.0 clt_parameters.min_shot, // double min_shot, // 10.0
...@@ -2176,7 +2170,7 @@ public class TwoQuadCLT { ...@@ -2176,7 +2170,7 @@ public class TwoQuadCLT {
// run texturesRBGA // run texturesRBGA
long startTexturesRBGA = System.nanoTime(); // System.nanoTime(); long startTexturesRBGA = System.nanoTime(); // System.nanoTime();
for (int i = 0; i < NREPEAT; i++ ) gPUTileProcessor.execRBGA( for (int i = 0; i < NREPEAT; i++ ) gpuQuad_main.execRBGA(
col_weights, // double [] color_weights, col_weights, // double [] color_weights,
quadCLT_main.isLwir(), // boolean is_lwir, quadCLT_main.isLwir(), // boolean is_lwir,
clt_parameters.min_shot, // double min_shot, // 10.0 clt_parameters.min_shot, // double min_shot, // 10.0
...@@ -2212,7 +2206,7 @@ public class TwoQuadCLT { ...@@ -2212,7 +2206,7 @@ public class TwoQuadCLT {
// get data back from GPU // get data back from GPU
float [][][] iclt_fimg = new float [GPUTileProcessor.NUM_CAMS][][]; float [][][] iclt_fimg = new float [GPUTileProcessor.NUM_CAMS][][];
for (int ncam = 0; ncam < iclt_fimg.length; ncam++) { for (int ncam = 0; ncam < iclt_fimg.length; ncam++) {
iclt_fimg[ncam] = gPUTileProcessor.getRBG(ncam); iclt_fimg[ncam] = gpuQuad_main.getRBG(ncam);
} }
int out_width = GPUTileProcessor.IMG_WIDTH + GPUTileProcessor.DTT_SIZE; int out_width = GPUTileProcessor.IMG_WIDTH + GPUTileProcessor.DTT_SIZE;
...@@ -2228,7 +2222,7 @@ public class TwoQuadCLT { ...@@ -2228,7 +2222,7 @@ public class TwoQuadCLT {
extra_titles[g * GPUTileProcessor.NUM_CAMS+ncam]= extra_group_titles[g]+"-"+ncam; extra_titles[g * GPUTileProcessor.NUM_CAMS+ncam]= extra_group_titles[g]+"-"+ncam;
} }
} }
float [][] extra = gPUTileProcessor.getExtra(); float [][] extra = gpuQuad_main.getExtra();
(new ShowDoubleFloatArrays()).showArrays( (new ShowDoubleFloatArrays()).showArrays(
extra, extra,
tilesX, tilesX,
...@@ -2260,8 +2254,8 @@ public class TwoQuadCLT { ...@@ -2260,8 +2254,8 @@ public class TwoQuadCLT {
//show_corr //show_corr
int [] wh = new int[2]; int [] wh = new int[2];
if (clt_parameters.show_corr) { if (clt_parameters.show_corr) {
int [] corr_indices = gPUTileProcessor.getCorrIndices(); int [] corr_indices = gpuQuad_main.getCorrIndices();
float [][] corr2D = gPUTileProcessor.getCorr2D( float [][] corr2D = gpuQuad_main.getCorr2D(
clt_parameters.gpu_corr_rad); // int corr_rad); clt_parameters.gpu_corr_rad); // int corr_rad);
// convert to 6-layer image using tasks // convert to 6-layer image using tasks
double [][] dbg_corr = GPUTileProcessor.getCorr2DView( double [][] dbg_corr = GPUTileProcessor.getCorr2DView(
...@@ -2344,7 +2338,7 @@ public class TwoQuadCLT { ...@@ -2344,7 +2338,7 @@ public class TwoQuadCLT {
// Use GPU prepared RBGA // Use GPU prepared RBGA
if (clt_parameters.show_rgba_color) { if (clt_parameters.show_rgba_color) {
Rectangle woi = new Rectangle(); Rectangle woi = new Rectangle();
float [][] rbga = gPUTileProcessor.getRBGA( float [][] rbga = gpuQuad_main.getRBGA(
(is_mono?1:3), // int num_colors, (is_mono?1:3), // int num_colors,
woi); woi);
(new ShowDoubleFloatArrays()).showArrays( (new ShowDoubleFloatArrays()).showArrays(
...@@ -2413,12 +2407,12 @@ public class TwoQuadCLT { ...@@ -2413,12 +2407,12 @@ public class TwoQuadCLT {
if (clt_parameters.show_rgba_color && (debugLevel > 100)) { // disabling if (clt_parameters.show_rgba_color && (debugLevel > 100)) { // disabling
int numcol = quadCLT_main.isMonochrome()?1:3; int numcol = quadCLT_main.isMonochrome()?1:3;
int ports = imp_quad_main.length; int ports = imp_quad_main.length;
int [] texture_indices = gPUTileProcessor.getTextureIndices(); int [] texture_indices = gpuQuad_main.getTextureIndices();
int num_src_slices = numcol + 1 + (clt_parameters.keep_weights?(ports + numcol + 1):0); // 12 ; // calculate int num_src_slices = numcol + 1 + (clt_parameters.keep_weights?(ports + numcol + 1):0); // 12 ; // calculate
// float [][][] ftextures = gPUTileProcessor.getTextures( // float [][][] ftextures = gPUTileProcessor.getTextures(
// (is_mono?1:3), // int num_colors, // (is_mono?1:3), // int num_colors,
// clt_parameters.keep_weights); // boolean keep_weights); // clt_parameters.keep_weights); // boolean keep_weights);
float [] flat_textures = gPUTileProcessor.getFlatTextures( float [] flat_textures = gpuQuad_main.getFlatTextures(
texture_indices.length, texture_indices.length,
(is_mono?1:3), // int num_colors, (is_mono?1:3), // int num_colors,
clt_parameters.keep_weights); // boolean keep_weights); clt_parameters.keep_weights); // boolean keep_weights);
...@@ -2447,7 +2441,7 @@ public class TwoQuadCLT { ...@@ -2447,7 +2441,7 @@ public class TwoQuadCLT {
} }
} }
} }
double [][][][] texture_tiles = gPUTileProcessor.doubleTextures( double [][][][] texture_tiles = gpuQuad_main.doubleTextures(
new Rectangle(0, 0, tilesX, tilesY), // Rectangle woi, new Rectangle(0, 0, tilesX, tilesY), // Rectangle woi,
texture_indices, // int [] indices, texture_indices, // int [] indices,
flat_textures, // float [][][] ftextures, flat_textures, // float [][][] ftextures,
......
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