Commit 907cda8d authored by Andrey Filippov's avatar Andrey Filippov

Using Marco's help to make jcuda work with nvrtc with cdp

parent 0d087c0b
......@@ -333,7 +333,7 @@ public class CLTParameters {
public double infinityDistance = 10000; // Distance to generate backdrop (0 - use regular backdrop)
public int min_bgnd_tiles = 10; // Minimal number of background tiles to generate background
public boolean shUseFlaps = true; // Split into shells with flaps
public boolean shAggrFade = true; // Aggressive fade alpha (whole boundary)
public boolean shAggrFade = false; // true; // Aggressive fade alpha (whole boundary)
public int shMinArea = 1; // Minimal shell area (not counting flaps
public double shMinStrength = 0.2; // Minimal value of the shell maximum strength
......
......@@ -3867,7 +3867,9 @@ public class ImageDtt {
double [][] port_weights = new double[ports][tile_len];
double [][] color_avg = new double[numcol][tile_len];
double [][] rgba = new double[numcol + 1 + (keep_weights?(ports + numcol + 1):0)][];
// double [][] rgba = new double[numcol + 1 + (keep_weights?(ports + numcol + 1):0)][];
// need to pass keep_weights to the caller
double [][] rgba = new double[numcol + 1 + ports + (keep_weights?(numcol + 1):0)][];
int rms_start = numcol + 1 + ports;
if (keep_weights){
for (int ncol = 0; ncol <= numcol ; ncol++) if ((ncol == numcol) || (iclt_tile[0][ncol] != null)) {
......@@ -4069,8 +4071,11 @@ public class ImageDtt {
rgba[ncol] = color_avg[ncol];
}
rgba[numcol] = alpha;
for (int i = 0; i < ports; i++) rgba[numcol + 1 + i] = port_weights[i];
// if (keep_weights){
for (int i = 0; i < ports; i++) {
rgba[numcol + 1 + i] = port_weights[i];
}
// }
if (max_diff != null){
for (int ip = 0; ip < ports; ip++){
max_diff[ip] = 0;
......@@ -5026,7 +5031,7 @@ public class ImageDtt {
System.out.println("iclt_2d():sharp_alpha= "+sharp_alpha);
}
boolean has_weights = false;
boolean set_has_weight = false;
boolean set_has_weight = false; // not used
for (int i = 0; (i < tilesY) && !set_has_weight; i++){
for (int j = 0; (j < tilesX) && !set_has_weight; j++){
if (texture_tiles[i][j] != null) {
......@@ -5064,15 +5069,15 @@ public class ImageDtt {
int n_half = transform_size / 2;
int lastY = tilesY-1;
int lastX = tilesX-1;
int offset = n_half * (transform_size * tilesX) + n_half;
int offset = n_half * (transform_size * tilesX) + n_half; // 4 pixels left and down (right/up when subtracted below)
for (int nTile = ai.getAndIncrement(); nTile < tiles_list[nser.get()].length; nTile = ai.getAndIncrement()) {
tileX = tiles_list[nser.get()][nTile][0];
tileY = tiles_list[nser.get()][nTile][1];
double [][] texture_tile =texture_tiles[tileY][tileX];
if (texture_tile != null) {
if (overlap) {
if ((tileY >0) && (tileX > 0) && (tileY < lastY) && (tileX < lastX)) { // fast, no extra checks
for (int i = 0; i < n2;i++){
if ((tileY >0) && (tileX > 0) && (tileY < lastY) && (tileX < lastX)) { // fast, no extra checks - ignore first/last rows and columns
for (int i = 0; i < n2; i++){
int start_line = ((tileY*transform_size + i) * tilesX + tileX)*transform_size - offset;
for (int chn = 0; chn < texture_tile.length; chn++) {
int schn = chn;
......@@ -5082,6 +5087,7 @@ public class ImageDtt {
if (texture_tile[schn] == null) {
dpixels[chn] = null;
} else {
// should it be better to multiply each color by alpha before accumulating? No, it is already windowed!
if ((chn != 3) || !sharp_alpha) {
for (int j = 0; j<n2;j++) {
dpixels[chn][start_line + j] += texture_tile[schn][n2 * i + j];
......@@ -9278,6 +9284,14 @@ public class ImageDtt {
}
}
}
// fix: removing extra slices
if (!clt_parameters.keep_weights && (texture_tiles[tileY][tileX]!=null)) {
if (numcol == 3 ) {
texture_tiles[tileY][tileX] = new double[][] {texture_tiles[tileY][tileX][0],texture_tiles[tileY][tileX][1],texture_tiles[tileY][tileX][2],texture_tiles[tileY][tileX][3]};
} else {
texture_tiles[tileY][tileX] = new double[][] {texture_tiles[tileY][tileX][0],texture_tiles[tileY][tileX][1]};
}
}
}
public double [][] get2DCorrs(
......
......@@ -8985,6 +8985,7 @@ public class QuadCLT {
tp.clt_3d_passes.add(latest_scan); // put it back
}
int next_pass = tp.clt_3d_passes.size(); //
// Create tasks to scan, have tasks, disparity and border tiles in tp.clt_3d_passes
tp.thirdPassSetupSurf( // prepare tile tasks for the second pass based on the previous one(s) // needs last scan
clt_parameters,
//FIXME: make a special parameter?
......@@ -9564,6 +9565,7 @@ public class QuadCLT {
double [] alpha_zero = new double [4*image_dtt.transform_size*image_dtt.transform_size];
int alpha_index = 3;
for (int i = 0; i < alpha_zero.length; i++) alpha_zero[i]=0.0;
// border tiles are copied, alpha from alphaFade (not multiplied?)
for (int tileY = 0; tileY < tilesY; tileY++){
for (int tileX = 0; tileX < tilesX; tileX++){
texture_tiles_cluster[tileY][tileX]= null;
......@@ -9607,7 +9609,7 @@ public class QuadCLT {
texture_overlap[alpha_index][i] = d;
}
}
// for now - use just RGB. Later add option for RGBA
// for now - use just RGB. Later add option for RGBA (?)
double [][] texture_rgb = {texture_overlap[0],texture_overlap[1],texture_overlap[2]};
double [][] texture_rgba = {texture_overlap[0],texture_overlap[1],texture_overlap[2],texture_overlap[3]};
double [][] texture_rgbx = ((clt_parameters.alpha1 > 0)? texture_rgba: texture_rgb);
......
......@@ -2191,7 +2191,9 @@ public class TwoQuadCLT {
}
if (clt_parameters.show_rgba_color) {
int num_src_slices = 12 ; // calculate
int numcol = quadCLT_main.isMonochrome()?1:3;
int ports = imp_quad_main.length;
int num_src_slices = numcol + 1 + (clt_parameters.keep_weights?(ports + numcol + 1):0); // 12 ; // calculate
// float [][][] ftextures = gPUTileProcessor.getTextures(
// (is_mono?1:3), // int num_colors,
// clt_parameters.keep_weights); // boolean keep_weights);
......@@ -3533,7 +3535,7 @@ if (debugLevel > -100) return true; // temporarily !
}
}
quadCLT_main.writeKml(debugLevel ); // alos generated with x3d model
quadCLT_main.writeKml(debugLevel ); // also generated with x3d model
String jp4_copy_path= quadCLT_main.correctionsParameters.selectX3dDirectory(
set_name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
......
......@@ -69,7 +69,7 @@ public class X3dOutput {
CLTParameters clt_parameters,
EyesisCorrectionParameters.CorrectionParameters correctionsParameters,
GeometryCorrection geometry_correction,
ArrayList <CLTPass3d> clt_3d_passes){
ArrayList <CLTPass3d> clt_3d_passes){ // to scan for textures, contain disp, tasks, border tiles
this.clt_parameters = clt_parameters;
this.correctionsParameters = correctionsParameters;
this.geometry_correction = geometry_correction;
......
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