Commit 1e2d8ada authored by Andrey Filippov's avatar Andrey Filippov

First run of TD neighbors

parent 8623329f
......@@ -126,6 +126,7 @@ public class GpuQuad{ // quad camera description
private int sensor_mask_inter = -1;
private int [] corr_mask_indices = null;
private int [] sensor_mask_inter_indices = null;
private int [] sensor_mask_inter_indices_neibs = null;
public boolean [] getCorrMask() {
......@@ -513,13 +514,17 @@ public class GpuQuad{ // quad camera description
public void setSensorMaskInter(int mask) {
sensor_mask_inter = mask & ((1 << num_cams) -1);
sensor_mask_inter_indices = new int [getNumCamsInter()+1];
sensor_mask_inter_indices_neibs = new int [getNumCamsInter()+2];
int indx = 0;
for (int i = 0; i < num_cams; i++) {
if ((sensor_mask_inter & (1 << (i & 31))) != 0) {
sensor_mask_inter_indices[indx++] = i;
}
}
sensor_mask_inter_indices[indx++] = 0xff; // sum
sensor_mask_inter_indices[indx] = 0xff; // sum
sensor_mask_inter_indices_neibs[indx++] = 0xff; // sum
sensor_mask_inter_indices_neibs[indx++] = 0xfe; // sumof neibs
}
public int getNumCamsInter() {
return Integer.bitCount(sensor_mask_inter);
......@@ -530,7 +535,24 @@ public class GpuQuad{ // quad camera description
public int [] getSensInter() {
return sensor_mask_inter_indices;
}
/*
public int getSensInterNeib(int indx) { // not used
return sensor_mask_inter_indices_neibs[indx];
}
*/
public int [] getSensInterNeib() {
return sensor_mask_inter_indices_neibs;
}
public int [] getSensInterNeib(boolean full) {
return full? sensor_mask_inter_indices_neibs : (new int [] {
sensor_mask_inter_indices_neibs[sensor_mask_inter_indices_neibs.length -2],
sensor_mask_inter_indices_neibs[sensor_mask_inter_indices_neibs.length -1]});
}
/*
public int getSensInterNeib(int indx, boolean full) {
return full? sensor_mask_inter_indices_neibs[indx] : getSensInterNeib(false)[indx];
}
*/
public void setGeometryCorrection() { // will reset geometry_correction_set when running GPU kernel
// if (geometry_correction_set) return;
......@@ -3029,6 +3051,37 @@ public class GpuQuad{ // quad camera description
}
public float [][][] getCorrTilesLayerTD(
int [] indices,
float [] fdata,
boolean inter,
int pair) {
int tilesX = img_width / GPUTileProcessor.DTT_SIZE;
int tilesY = img_height / GPUTileProcessor.DTT_SIZE;
int num_pairs = inter? (getNumCamsInter() + 1 + 0): getNumUsedPairs();// Number of used pairs num_pairs = num_pairs_in;
final int corr_size_td = 4 * GPUTileProcessor.DTT_SIZE * GPUTileProcessor.DTT_SIZE;
// int [] indices = getCorrIndices(); // also sets num_corr_tiles
// float [] fdata = getCorrTdData();
int num_tiles = num_corr_tiles / num_pairs;
float [][][] corr_tiles = new float [tilesY][tilesX][];
for (int nt = 0; nt < num_tiles; nt++ ) {
int nTile = (indices[nt * num_pairs] >> GPUTileProcessor.CORR_NTILE_SHIFT);
int ty = nTile / tilesX;
int tx = nTile % tilesX;
corr_tiles[ty][tx] = new float [corr_size_td];
System.arraycopy(
fdata,
(nt * num_pairs + pair) * corr_size_td,
corr_tiles[ty][tx],
0,
corr_size_td);
}
return corr_tiles;
}
public int [] setCorrTilesComboTd( // not used?
final float [][][] corr_tiles, // [tileY][tileX][4*64]
......
......@@ -13152,16 +13152,17 @@ public class OpticalFlow {
}
boolean use_neibs = clt_parameters.imp.use_neibs; // false; // true;
boolean use_neibs_pd = true;
boolean neibs_nofpn_only = clt_parameters.imp.neibs_nofpn_only |
(initial_adjust && clt_parameters.imp.neibs_nofpn_init); // consolidate neighbors fot non-fpn tiles only!
boolean redo_both = clt_parameters.imp.redo_both; // use average of neighbors for both pd,td if any of the center tile tests (td, pd) fails
int min_num_neibs = clt_parameters.imp.min_num_neibs; // plus center, total number >= (min_num_neibs+1)
double scale_neibs_pd = use_neibs? clt_parameters.imp.scale_neibs_pd : 0; // scale threshold for the pixel-domain average maximums
double scale_neibs_td = use_neibs? clt_parameters.imp.scale_neibs_td : 0; // scale threshold for the transform-domain average maximums
double scale_neibs_pd = use_neibs_pd? clt_parameters.imp.scale_neibs_pd : 0; // scale threshold for the pixel-domain average maximums
double scale_neibs_td = use_neibs_pd? clt_parameters.imp.scale_neibs_td : 0; // scale threshold for the transform-domain average maximums
double scale_avg_weight = clt_parameters.imp.scale_avg_weight; // reduce influence of the averaged correlations compared to the single-tile ones
int [] corr_indices_dbg = show_2d_correlations? image_dtt.getGPU().getCorrIndices() : null;
boolean use_partial = clt_parameters.imp.use_partial;
coord_motion = image_dtt.clt_process_tl_interscene( // convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
// only used here to keep extra array element for disparity difference
......@@ -13184,7 +13185,7 @@ public class OpticalFlow {
fpn_ignore_border, // final boolean fpn_ignore_border, // only if fpn_mask != null - ignore tile if maximum touches fpn_mask
motion_vectors, // final double [][][] motion_vectors, // [tilesY*tilesX][][] -> [][][num_sel_sensors+1][2]
clt_parameters.imp.run_poly, // final boolean run_poly, // polynomial max, if false - centroid
clt_parameters.imp.use_partial, // final boolean use_partial, // find motion vectors for individual pairs, false - for sum only
use_partial, // final boolean use_partial, // find motion vectors for individual pairs, false - for sum only
clt_parameters.imp.centroid_radius,// final double centroid_radius, // 0 - use all tile, >0 - cosine window around local max
clt_parameters.imp.n_recenter, // final int n_recenter, // when cosine window, re-center window this many times
clt_parameters.imp.td_weight, // final double td_weight, // mix correlations accumulated in TD with
......@@ -15131,7 +15132,7 @@ public class OpticalFlow {
double disparity_weight = use3D? clt_parameters.ilp.ilma_disparity_weight : 0.0;
int margin = clt_parameters.imp.margin;
int sensor_mask_inter = clt_parameters.imp.sensor_mask_inter ; //-1;
float [][][] facc_2d_img = new float [1][][];
float [][][] facc_2d_img = new float [1][][]; // set it to null?
IntersceneLma intersceneLma = new IntersceneLma(
clt_parameters.ilp.ilma_thread_invariant,
disparity_weight);
......
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