Loading src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java +6 −3 Original line number Diff line number Diff line Loading @@ -134,17 +134,19 @@ public class GPUTileProcessor { // static int TPTASK_SIZE = 1+ 1+ NUM_CAMS * 2 + 1 + NUM_CAMS * 4 ; // tp_task structure size in floats static int CLTEXTRA_SIZE = 8; static int CORR_SIZE = (2* DTT_SIZE - 1) * (2* DTT_SIZE - 1); // 15x15 public static int CORR_NTILE_SHIFT = 8; // also for texture tiles list public static int CORR_NTILE_SHIFT = 8; // also for texture tiles list - not anymore 11/18/2022 // FIXME: CORR_PAIRS_MASK will not work !!! public static int CORR_PAIRS_MASK = 0x3f; // lower bits used to address correlation pair for the selected tile public static int CORR_TEXTURE_BIT = 7; // bit 7 used to request texture for the tile // public static int CORR_TEXTURE_BIT = 7; // bit 7 used to request texture for the tile GET RID !!! public static int TASK_CORR_BITS = 4; // start of pair mask public static int TASK_TEXTURE_N_BIT = 0; // Texture with North neighbor public static int TASK_TEXTURE_E_BIT = 1; // Texture with East neighbor public static int TASK_TEXTURE_S_BIT = 2; // Texture with South neighbor public static int TASK_TEXTURE_W_BIT = 3; // Texture with West neighbor // public static int TASK_TEXTURE_BIT = 3; // bit to request texture calculation int task field of struct tp_task public static int LIST_TEXTURE_BIT = 7; // bit to request texture calculation public static int TEXT_NTILE_SHIFT = 8; // split from CORR_NTILE_SHIFT // public static int CORR_OUT_RAD = 4; // output radius of the correlations (implemented) public static double FAT_ZERO_WEIGHT = 0.0001; // add to port weights to avoid nan Loading Loading @@ -226,13 +228,14 @@ public class GPUTileProcessor { "#define IMCLT_TILES_PER_BLOCK " + IMCLT_TILES_PER_BLOCK+"\n"+ "#define CORR_NTILE_SHIFT " + CORR_NTILE_SHIFT+"\n"+ // "#define CORR_PAIRS_MASK " + CORR_PAIRS_MASK+"\n"+ "#define CORR_TEXTURE_BIT " + CORR_TEXTURE_BIT+"\n"+ // "#define CORR_TEXTURE_BIT " + CORR_TEXTURE_BIT+"\n"+ "#define TASK_CORR_BITS " + TASK_CORR_BITS+"\n"+ "#define TASK_TEXTURE_N_BIT " + TASK_TEXTURE_N_BIT+"\n"+ "#define TASK_TEXTURE_E_BIT " + TASK_TEXTURE_E_BIT+"\n"+ "#define TASK_TEXTURE_S_BIT " + TASK_TEXTURE_S_BIT+"\n"+ "#define TASK_TEXTURE_W_BIT " + TASK_TEXTURE_W_BIT+"\n"+ "#define LIST_TEXTURE_BIT " + LIST_TEXTURE_BIT+"\n"+ "#define TEXT_NTILE_SHIFT " + TEXT_NTILE_SHIFT+"\n"+ // "#define CORR_OUT_RAD " + CORR_OUT_RAD+"\n" + "#define FAT_ZERO_WEIGHT " + FAT_ZERO_WEIGHT+"\n"+ "#define THREADS_DYNAMIC_BITS " + THREADS_DYNAMIC_BITS+"\n"+ Loading src/main/java/com/elphel/imagej/gpu/GpuQuad.java +3 −65 Original line number Diff line number Diff line Loading @@ -1304,68 +1304,6 @@ public class GpuQuad{ // quad camera description } /** * Prepare contents pointers for calculation of the correlation pairs * @param tp_tasks array of tasks that contain masks of the required pairs * @return each element has (tile_number << 8) | (pair_number & 0xff) */ @Deprecated public int [] getCorrTasks( TpTask [] tp_tasks) { int tilesX = img_width / GPUTileProcessor.DTT_SIZE; int num_corr = 0; int num_pairs = Correlation2d.getNumPairs(quadCLT.getNumSensors()); int task_mask = (1 << num_pairs) - 1; for (TpTask tt: tp_tasks) { int pm = (tt.task >> GPUTileProcessor.TASK_CORR_BITS) & task_mask; if (pm != 0) { for (int b = 0; b < num_pairs; b++) if ((pm & (1 << b)) != 0) { num_corr++; } } } int [] iarr = new int[num_corr]; num_corr = 0; for (TpTask tt: tp_tasks) { int pm = (tt.task >> GPUTileProcessor.TASK_CORR_BITS) & task_mask; if (pm != 0) { int tile = (tt.ty * tilesX +tt.tx); for (int b = 0; b < num_pairs; b++) if ((pm & (1 << b)) != 0) { iarr[num_corr++] = (tile << GPUTileProcessor.CORR_NTILE_SHIFT) | b; } } } return iarr; } /** * Prepare contents pointers for calculation of the texture tiles (RGBA, 16x16) * @param tp_tasks array of tasks that contain masks of the required pairs * @return each element has (tile_number << 8) | (1 << LIST_TEXTURE_BIT) */ @Deprecated public int [] getTextureTasks( TpTask [] tp_tasks) { int tilesX = img_width / GPUTileProcessor.DTT_SIZE; int num_textures = 0; for (TpTask tt: tp_tasks) { if ((tt.task & GPUTileProcessor.TASK_TEXTURE_BITS) !=0) { num_textures++; } } int [] iarr = new int[num_textures]; num_textures = 0; int b = (1 << GPUTileProcessor.LIST_TEXTURE_BIT); for (TpTask tt: tp_tasks) { if ((tt.task & GPUTileProcessor.TASK_TEXTURE_BITS) !=0) { int tile = (tt.ty * tilesX +tt.tx); iarr[num_textures++] = (tile << GPUTileProcessor.CORR_NTILE_SHIFT) | b; } } return iarr; } /** * Calculate rotation matrices and their derivatives * Needed after extrinsics changed Loading Loading @@ -3284,8 +3222,8 @@ public class GpuQuad{ // quad camera description int tilesY = img_height / GPUTileProcessor.DTT_SIZE; float [][] extra = new float[num_tile_extra][tilesX*tilesY]; for (int i = 0; i < texture_indices.length; i++) { if (((texture_indices[i] >> GPUTileProcessor.CORR_TEXTURE_BIT) & 1) != 0) { int ntile = (texture_indices[i] >> GPUTileProcessor.CORR_NTILE_SHIFT); if (((texture_indices[i] >> GPUTileProcessor.LIST_TEXTURE_BIT) & 1) != 0) { int ntile = (texture_indices[i] >> GPUTileProcessor.TEXT_NTILE_SHIFT); for (int l = 0; l < num_tile_extra; l++) { extra[l][ntile] = diff_rgb_combo[i * num_tile_extra + l]; } Loading Loading @@ -3439,7 +3377,7 @@ public class GpuQuad{ // quad camera description // double [][][][] textures = new double [woi.height][woi.width][num_slices][texture_slice_size]; for (int indx = 0; indx < indices.length; indx++) if ((indices[indx] & (1 << GPUTileProcessor.LIST_TEXTURE_BIT)) != 0){ int tile = (indices[indx] >> GPUTileProcessor.CORR_NTILE_SHIFT); int tile = (indices[indx] >> GPUTileProcessor.TEXT_NTILE_SHIFT); int tileX = tile % full_width; int tileY = tile / full_width; int wtileX = tileX - woi.x; Loading src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java +2 −2 Original line number Diff line number Diff line Loading @@ -1782,7 +1782,7 @@ public class QuadCLT extends QuadCLTCPU { final QuadCLT ref_scene, // now - may be null - for testing if scene is rotated ref final boolean filter_bg, // remove bg tiles (possibly occluded) final double max_distortion, // maximal neighbor tiles offset as a fraction of tile size (8) final int [] cluster_index, // final int [] cluster_index, // [tilesX*tilesY] final boolean [] border, // border tiles final boolean keep_channels, final int debugLevel){ Loading Loading @@ -3386,7 +3386,7 @@ public class QuadCLT extends QuadCLTCPU { if (debugLevel > -1) { for (int indx = 0; indx < texture_indices.length; indx++) if ((texture_indices[indx] & (1 << GPUTileProcessor.LIST_TEXTURE_BIT)) != 0){ int tile = texture_indices[indx] >> GPUTileProcessor.CORR_NTILE_SHIFT; int tile = texture_indices[indx] >> GPUTileProcessor.TEXT_NTILE_SHIFT; int tileX = tile % tilesX; int tileY = tile / tilesX; if ((tileY == clt_parameters.tileY) && (tileX == clt_parameters.tileX)) { Loading Loading
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java +6 −3 Original line number Diff line number Diff line Loading @@ -134,17 +134,19 @@ public class GPUTileProcessor { // static int TPTASK_SIZE = 1+ 1+ NUM_CAMS * 2 + 1 + NUM_CAMS * 4 ; // tp_task structure size in floats static int CLTEXTRA_SIZE = 8; static int CORR_SIZE = (2* DTT_SIZE - 1) * (2* DTT_SIZE - 1); // 15x15 public static int CORR_NTILE_SHIFT = 8; // also for texture tiles list public static int CORR_NTILE_SHIFT = 8; // also for texture tiles list - not anymore 11/18/2022 // FIXME: CORR_PAIRS_MASK will not work !!! public static int CORR_PAIRS_MASK = 0x3f; // lower bits used to address correlation pair for the selected tile public static int CORR_TEXTURE_BIT = 7; // bit 7 used to request texture for the tile // public static int CORR_TEXTURE_BIT = 7; // bit 7 used to request texture for the tile GET RID !!! public static int TASK_CORR_BITS = 4; // start of pair mask public static int TASK_TEXTURE_N_BIT = 0; // Texture with North neighbor public static int TASK_TEXTURE_E_BIT = 1; // Texture with East neighbor public static int TASK_TEXTURE_S_BIT = 2; // Texture with South neighbor public static int TASK_TEXTURE_W_BIT = 3; // Texture with West neighbor // public static int TASK_TEXTURE_BIT = 3; // bit to request texture calculation int task field of struct tp_task public static int LIST_TEXTURE_BIT = 7; // bit to request texture calculation public static int TEXT_NTILE_SHIFT = 8; // split from CORR_NTILE_SHIFT // public static int CORR_OUT_RAD = 4; // output radius of the correlations (implemented) public static double FAT_ZERO_WEIGHT = 0.0001; // add to port weights to avoid nan Loading Loading @@ -226,13 +228,14 @@ public class GPUTileProcessor { "#define IMCLT_TILES_PER_BLOCK " + IMCLT_TILES_PER_BLOCK+"\n"+ "#define CORR_NTILE_SHIFT " + CORR_NTILE_SHIFT+"\n"+ // "#define CORR_PAIRS_MASK " + CORR_PAIRS_MASK+"\n"+ "#define CORR_TEXTURE_BIT " + CORR_TEXTURE_BIT+"\n"+ // "#define CORR_TEXTURE_BIT " + CORR_TEXTURE_BIT+"\n"+ "#define TASK_CORR_BITS " + TASK_CORR_BITS+"\n"+ "#define TASK_TEXTURE_N_BIT " + TASK_TEXTURE_N_BIT+"\n"+ "#define TASK_TEXTURE_E_BIT " + TASK_TEXTURE_E_BIT+"\n"+ "#define TASK_TEXTURE_S_BIT " + TASK_TEXTURE_S_BIT+"\n"+ "#define TASK_TEXTURE_W_BIT " + TASK_TEXTURE_W_BIT+"\n"+ "#define LIST_TEXTURE_BIT " + LIST_TEXTURE_BIT+"\n"+ "#define TEXT_NTILE_SHIFT " + TEXT_NTILE_SHIFT+"\n"+ // "#define CORR_OUT_RAD " + CORR_OUT_RAD+"\n" + "#define FAT_ZERO_WEIGHT " + FAT_ZERO_WEIGHT+"\n"+ "#define THREADS_DYNAMIC_BITS " + THREADS_DYNAMIC_BITS+"\n"+ Loading
src/main/java/com/elphel/imagej/gpu/GpuQuad.java +3 −65 Original line number Diff line number Diff line Loading @@ -1304,68 +1304,6 @@ public class GpuQuad{ // quad camera description } /** * Prepare contents pointers for calculation of the correlation pairs * @param tp_tasks array of tasks that contain masks of the required pairs * @return each element has (tile_number << 8) | (pair_number & 0xff) */ @Deprecated public int [] getCorrTasks( TpTask [] tp_tasks) { int tilesX = img_width / GPUTileProcessor.DTT_SIZE; int num_corr = 0; int num_pairs = Correlation2d.getNumPairs(quadCLT.getNumSensors()); int task_mask = (1 << num_pairs) - 1; for (TpTask tt: tp_tasks) { int pm = (tt.task >> GPUTileProcessor.TASK_CORR_BITS) & task_mask; if (pm != 0) { for (int b = 0; b < num_pairs; b++) if ((pm & (1 << b)) != 0) { num_corr++; } } } int [] iarr = new int[num_corr]; num_corr = 0; for (TpTask tt: tp_tasks) { int pm = (tt.task >> GPUTileProcessor.TASK_CORR_BITS) & task_mask; if (pm != 0) { int tile = (tt.ty * tilesX +tt.tx); for (int b = 0; b < num_pairs; b++) if ((pm & (1 << b)) != 0) { iarr[num_corr++] = (tile << GPUTileProcessor.CORR_NTILE_SHIFT) | b; } } } return iarr; } /** * Prepare contents pointers for calculation of the texture tiles (RGBA, 16x16) * @param tp_tasks array of tasks that contain masks of the required pairs * @return each element has (tile_number << 8) | (1 << LIST_TEXTURE_BIT) */ @Deprecated public int [] getTextureTasks( TpTask [] tp_tasks) { int tilesX = img_width / GPUTileProcessor.DTT_SIZE; int num_textures = 0; for (TpTask tt: tp_tasks) { if ((tt.task & GPUTileProcessor.TASK_TEXTURE_BITS) !=0) { num_textures++; } } int [] iarr = new int[num_textures]; num_textures = 0; int b = (1 << GPUTileProcessor.LIST_TEXTURE_BIT); for (TpTask tt: tp_tasks) { if ((tt.task & GPUTileProcessor.TASK_TEXTURE_BITS) !=0) { int tile = (tt.ty * tilesX +tt.tx); iarr[num_textures++] = (tile << GPUTileProcessor.CORR_NTILE_SHIFT) | b; } } return iarr; } /** * Calculate rotation matrices and their derivatives * Needed after extrinsics changed Loading Loading @@ -3284,8 +3222,8 @@ public class GpuQuad{ // quad camera description int tilesY = img_height / GPUTileProcessor.DTT_SIZE; float [][] extra = new float[num_tile_extra][tilesX*tilesY]; for (int i = 0; i < texture_indices.length; i++) { if (((texture_indices[i] >> GPUTileProcessor.CORR_TEXTURE_BIT) & 1) != 0) { int ntile = (texture_indices[i] >> GPUTileProcessor.CORR_NTILE_SHIFT); if (((texture_indices[i] >> GPUTileProcessor.LIST_TEXTURE_BIT) & 1) != 0) { int ntile = (texture_indices[i] >> GPUTileProcessor.TEXT_NTILE_SHIFT); for (int l = 0; l < num_tile_extra; l++) { extra[l][ntile] = diff_rgb_combo[i * num_tile_extra + l]; } Loading Loading @@ -3439,7 +3377,7 @@ public class GpuQuad{ // quad camera description // double [][][][] textures = new double [woi.height][woi.width][num_slices][texture_slice_size]; for (int indx = 0; indx < indices.length; indx++) if ((indices[indx] & (1 << GPUTileProcessor.LIST_TEXTURE_BIT)) != 0){ int tile = (indices[indx] >> GPUTileProcessor.CORR_NTILE_SHIFT); int tile = (indices[indx] >> GPUTileProcessor.TEXT_NTILE_SHIFT); int tileX = tile % full_width; int tileY = tile / full_width; int wtileX = tileX - woi.x; Loading
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java +2 −2 Original line number Diff line number Diff line Loading @@ -1782,7 +1782,7 @@ public class QuadCLT extends QuadCLTCPU { final QuadCLT ref_scene, // now - may be null - for testing if scene is rotated ref final boolean filter_bg, // remove bg tiles (possibly occluded) final double max_distortion, // maximal neighbor tiles offset as a fraction of tile size (8) final int [] cluster_index, // final int [] cluster_index, // [tilesX*tilesY] final boolean [] border, // border tiles final boolean keep_channels, final int debugLevel){ Loading Loading @@ -3386,7 +3386,7 @@ public class QuadCLT extends QuadCLTCPU { if (debugLevel > -1) { for (int indx = 0; indx < texture_indices.length; indx++) if ((texture_indices[indx] & (1 << GPUTileProcessor.LIST_TEXTURE_BIT)) != 0){ int tile = texture_indices[indx] >> GPUTileProcessor.CORR_NTILE_SHIFT; int tile = texture_indices[indx] >> GPUTileProcessor.TEXT_NTILE_SHIFT; int tileX = tile % tilesX; int tileY = tile / tilesX; if ((tileY == clt_parameters.tileY) && (tileX == clt_parameters.tileX)) { Loading