Commit 164444fe authored by Andrey Filippov's avatar Andrey Filippov
Browse files

still working on textures

parent 433c7f7f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8044,7 +8044,7 @@ public class OpticalFlow {
			payload_blue_sky = new double[tiles];
			Arrays.fill(payload_blue_sky,Double.NaN);
		}
		
		combo_dsn_final[COMBO_DSN_INDX_BLUE_SKY] = payload_blue_sky;
		
		// restore modified parameters
		clt_parameters.img_dtt.bimax_combine_mode = save_bimax_combine_mode;
+22 −3
Original line number Diff line number Diff line
@@ -1788,7 +1788,9 @@ public class QuadCLT extends QuadCLTCPU {
			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,  // [tilesX*tilesY]
			final boolean []  border, // border tiles
			final boolean []  border, // border tiles for clusters?
			final int         discard_frame_edges, // do not use tiles that have pixels closer to the frame margins 
			final int         keep_frame_tiles, // do not discard pixels for border tiles in reference frame 
			final boolean     keep_channels,
			final int         debugLevel){
		// FIXME: Move to clt_parameters;
@@ -1990,8 +1992,12 @@ public class QuadCLT extends QuadCLTCPU {
		final int tilesX =    scene.getTileProcessor().getTilesX();
		final int tilesY =    scene.getTileProcessor().getTilesY();
		final int tiles =     tilesX*tilesY;
		int tile_size =       scene.getTileProcessor().getTileSize();
		final int tile_size =       scene.getTileProcessor().getTileSize();
		int tile_len =        tile_size*tile_size;
		// 		final int transform_size = clt_parameters.transform_size;
		final int full_width =  tilesX * tile_size; 
		final int full_height = tilesY * tile_size; 

		final double [][][][] texture_tiles88 = new double [tilesY][tilesX][][]; // here - non-overlapped!
		// copy from windowed output to 
		final TpTask[] ftp_tasks =    tp_tasks[0];
@@ -2033,7 +2039,7 @@ public class QuadCLT extends QuadCLTCPU {
		}		      
		ImageDtt.startAndJoin(threads);

		if (max_distortion > 0) {//  remove distorted tiles
		if ((max_distortion > 0) || (discard_frame_edges > 0)) {//  remove distorted tiles
			double max_distortion2 = max_distortion * max_distortion; 
			final TileNeibs tn =         new TileNeibs(tilesX, tilesY);
			final boolean [] distorted = new boolean [tiles];
@@ -2078,6 +2084,19 @@ public class QuadCLT extends QuadCLTCPU {
											}
										}
									}
									// see if the tile should be removed because it is too close to the edge of the scene frame
									if (!distorted[nTile] && (discard_frame_edges > 0)) {
										if ((tileX >= keep_frame_tiles) && (tileY >= keep_frame_tiles) &&
												(tileX < (tilesX - keep_frame_tiles)) && (tileY < (tilesY - keep_frame_tiles))) {
											if (
													(centerXY[0] < discard_frame_edges) ||
													(centerXY[1] < discard_frame_edges) ||
													(centerXY[0] > (full_width - discard_frame_edges-1)) ||													
													(centerXY[1] > (full_height - discard_frame_edges-1))) {
												distorted[nTile] = true;												
											}
										}
									}
								} else {
									if (debugLevel > -3) {
										System.out.println("Non-null texture for no-cluster, nTile="+nTile+
+8 −4
Original line number Diff line number Diff line
@@ -12056,6 +12056,7 @@ public class QuadCLTCPU {
								  clt_parameters.maxZtoXY,      // double          maxZtoXY,       // 10.0. <=0 - do not use
								  clt_parameters.maxZ,
								  clt_parameters.limitZ,
								  null, // dbg_disp_tri_slice, //   double [][]     dbg_disp_tri_slice,
								  debugLevel + 1); //   int             debug_level) > 0
					  } catch (IOException e) {
						  // TODO Auto-generated catch block
@@ -12155,6 +12156,7 @@ public class QuadCLTCPU {
						  clt_parameters.maxZtoXY,      // double          maxZtoXY,       // 10.0. <=0 - do not use
						  clt_parameters.maxZ,
						  clt_parameters.limitZ,
						  null, //   double [][]     dbg_disp_tri_slice,
						  debugLevel + 1); //   int             debug_level) > 0
			} catch (IOException e) {
				e.printStackTrace();
@@ -12204,6 +12206,7 @@ public class QuadCLTCPU {
			  double          maxZtoXY,        // 10.0. <=0 - do not use
			  double          maxZ,            // far clip (0 - do not clip). Negative - limit by max
			  boolean         limitZ,
			  double [][]     dbg_disp_tri_slice,
			  int             debug_level
			  ) throws IOException
	  {
@@ -12315,19 +12318,20 @@ public class QuadCLTCPU {
			  }
		  }
		  if (show_triangles) {
		  if (show_triangles || (dbg_disp_tri_slice != null)) {
			  double [] ddisp = (disparity == null)?(new double[1]):disparity;
			  if (disparity == null) {
				  ddisp[0] = min_disparity;
			  }
			  tp.testTriangles(
					  texturePath,
					  (show_triangles? texturePath: null),
					  bounds,
					  selected,
					  ddisp, // disparity, // if disparity.length == 1 - use for all
					  tile_size,
					  indices,
					  triangles);
					  triangles,
					  dbg_disp_tri_slice); // double [][] debug_triangles);
		  }
		  if (x3dOutput != null) {
		  x3dOutput.addCluster(
+776 −634

File changed.

Preview size limit exceeded, changes collapsed.

+101 −6
Original line number Diff line number Diff line
@@ -32,15 +32,19 @@ class TileCluster{
	double []  disparity;            // all and only unused - NaN 
	int []     cluster_index = null; // for debug purposes, index of the source cluster
	int        index = -1;
	boolean    is_sky = false;
	ArrayList<IndexedRectanle> clust_list;
	class IndexedRectanle{
		int index;
		Rectangle bounds;
		boolean is_sky;
		IndexedRectanle (
				int index,
				Rectangle bounds){
				Rectangle bounds,
				boolean is_sky){
			this.index = index;
			this.bounds = bounds;
			this.is_sky = is_sky;
		}
	}
	// to use cluster_index - set index >= 0, <0 - do not use.
@@ -48,9 +52,11 @@ class TileCluster{
			Rectangle  bounds,
			int index, // <0 to skip
			boolean [] border,
			double []  disparity){
			double []  disparity,
			boolean is_sky){
		this.bounds =    bounds;
		this.index = index;
		this.is_sky = is_sky;
		/**
		if (index >= 0) {
			this.cluster_index = new int [bounds.width * bounds.height];
@@ -72,10 +78,31 @@ class TileCluster{
		}
		this.disparity = disparity;
	}
	public boolean isSky() {
		return is_sky;
	}
	
	public int getSkyClusterIndex() {
		if (clust_list == null) {
			return -2;
		}
		for (int i = 0; i < clust_list.size(); i++) {
			if (clust_list.get(i).is_sky) {
				return i;
			}
		}
		return -1;
	}
	
	public Rectangle  getBounds() {return bounds;}
	public Rectangle  getBounds() {
		return bounds;
	}
	public Rectangle  getBounds(int gap) {
		return new Rectangle (bounds.x - gap, bounds.y - gap, bounds.width + 2* gap,  bounds.height + 2* gap);
	}
	public boolean [] getBorder() {return border;}
	public double []  getDisparity() {return disparity;}
	public void       setDisparity(double [] disparity) {this.disparity = disparity;}
	public double []  getSubDisparity(int indx) { // disparity should be NaN for unused !
		if (clust_list == null) {
			return null;
@@ -95,6 +122,32 @@ class TileCluster{
		return sub_disparity;
	}

	public void setSubDisparity(int indx, double [] sub_disparity) { // disparity should be NaN for unused !
		if (clust_list == null) {
			return;
		}
		Rectangle sub_bounds = clust_list.get(indx).bounds;
		int src_x = sub_bounds.x - bounds.x;
		for (int dst_y = 0; dst_y < sub_bounds.height; dst_y++) {
			int src_y = dst_y + sub_bounds.y - bounds.y;
			System.arraycopy(
					sub_disparity,
					dst_y * sub_bounds.width,
					disparity,
					src_y * bounds.width + src_x,
					sub_bounds.width);
		}		
	}
	
	
	
	public boolean isSubSky(int indx) {
		if (clust_list == null) {
			return false;
		}
		return clust_list.get(indx).is_sky;
	}
	
	public boolean []  getSubBorder(int indx) { // disparity should be NaN for unused !
		if (clust_list == null) {
			return null;
@@ -113,7 +166,7 @@ class TileCluster{
		}		
		return sub_border;
	}
	
	// returns selected for all non-NAN, so it is possible to use NEGATIVE_INFINITY for non-NaN
	public boolean []  getSubSelected(int indx) { // disparity should be NaN for unused !
		if (clust_list == null) {
			return null;
@@ -141,6 +194,15 @@ class TileCluster{
		return selected;
	}
	
	public Rectangle getSubBounds (int indx) {
		if (clust_list == null) {
			return null;
		} else {
			Rectangle sub_bounds = clust_list.get(indx).bounds;
			return sub_bounds;
		}
	}
	
	public Rectangle [] getSubBounds() {
		if (clust_list == null) {
			return null;
@@ -163,6 +225,9 @@ class TileCluster{
			return sub_indices;
		}
	}
	public void resetClusterIndex() { // to rebuild cluster index from disparity
		this.cluster_index = null; 
	}
	public int [] getClusterIndex() { // (Now not) just a debug feature, no need to optimize?
		if (clust_list == null) {
			return null;
@@ -183,6 +248,36 @@ class TileCluster{
			}
		}
		return cluster_index;
	}
	
	public void increaseBounds() {
		int num_subs = getSubBounds().length;
		for (int indx = 0; indx < num_subs; indx++) {
			increaseBounds(indx);
		}
	}

	public void increaseBounds(int sub_index) {
		Rectangle bounds = getSubBounds(sub_index);
		Rectangle ext_bounds = new Rectangle (bounds.x - 1, bounds.y - 1, bounds.width + 2, bounds.height + 2);
		if (ext_bounds.x < 0) {
			ext_bounds.width += ext_bounds.x;
			ext_bounds.x = 0;
		}
		if ((ext_bounds.x + ext_bounds.width) > this.bounds.width) {
			ext_bounds.width = this.bounds.width - ext_bounds.x;
		}
		if (ext_bounds.y < 0) {
			ext_bounds.height += ext_bounds.y;
			ext_bounds.y = 0;
		}
		if ((ext_bounds.y + ext_bounds.height) > this.bounds.height) {
			ext_bounds.height = this.bounds.height - ext_bounds.y;
		}
		bounds.x =      ext_bounds.x;
		bounds.y =      ext_bounds.y;
		bounds.width =  ext_bounds.width;
		bounds.height = ext_bounds.height;

	}

@@ -194,7 +289,7 @@ class TileCluster{
		if (clust_list == null) {
			clust_list =  new ArrayList<IndexedRectanle>();
		}
		clust_list.add(new IndexedRectanle(tileCluster.index, tileCluster.bounds));
		clust_list.add(new IndexedRectanle(tileCluster.index, tileCluster.bounds, tileCluster.isSky()));
		
		int dst_x = tileCluster.bounds.x - bounds.x;
		for (int src_y = 0; src_y < tileCluster.bounds.height; src_y++) {
Loading