Commit 93480b46 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Motion blur correction for rendering only

parent 7d6fb681
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -3842,19 +3842,21 @@ public class GpuQuad{ // quad camera description
		final int tilesX =  img_width / GPUTileProcessor.DTT_SIZE;
		final int tiles = pXpYD.length;
		final Matrix [] corr_rots = geometryCorrection.getCorrVector().getRotMatrices(); // get array of per-sensor rotation matrices
		final int quad_main = (geometryCorrection != null)? num_cams:0;
		final int quad_main = num_cams; // (geometryCorrection != null)? num_cams:0;
		final Thread[] threads = ImageDtt.newThreadArray(threadsMax);
		final AtomicInteger ai = new AtomicInteger(00);
		final AtomicInteger aTiles = new AtomicInteger(0);
		final TpTask[][] tp_tasks = new TpTask[2][tiles]; // aTiles.get()]; // [0] - main, [1] - shifted
		final double mb_len_scale = -Math.log(1.0 - 1.0/mb_max_gain);

		for (int ithread = 0; ithread < threads.length; ithread++) {
			threads[ithread] = new Thread() {
				@Override
				public void run() {
					for (int nTile = ai.getAndIncrement(); nTile < tiles; nTile = ai.getAndIncrement())
						if ((pXpYD[nTile] != null) && (mb_vectors[nTile] != null) && ((selection == null) || selection[nTile])) {
						if ((pXpYD[nTile] != null) &&
								!Double.isNaN(mb_vectors[0][nTile]) &&
								!Double.isNaN(mb_vectors[1][nTile]) &&
								((selection == null) || selection[nTile])) {
						int tileY = nTile / tilesX;
						int tileX = nTile % tilesX;
						TpTask tp_task =    new TpTask(num_cams, tileX, tileY);
@@ -3867,8 +3869,8 @@ public class GpuQuad{ // quad camera description
						double [] centerXY = pXpYD[nTile];
						tp_task.setCenterXY(centerXY); // this pair of coordinates will be used by GPU to set tp_task.xy and task.disp_dist!
						// calculate offset for the secondary tile and weigh
						double dx = mb_vectors[nTile][0];
						double dy = mb_vectors[nTile][1];
						double dx = mb_vectors[0][nTile];
						double dy = mb_vectors[1][nTile];
						double mb_len = Math.sqrt(dx*dx+dy*dy); // in pixels/s
						dx /= mb_len; // unit vector
						dy /= mb_len;
@@ -3887,7 +3889,6 @@ public class GpuQuad{ // quad camera description
						double gain_sub = -gain * exp_offs;
						tp_task.setScale(gain);
						tp_task_sub.setScale(gain_sub);
					
						boolean bad_margins = false;
						if (calcPortsCoordinatesAndDerivatives) { // for non-GPU?
							double [][] disp_dist = new double[quad_main][]; // used to correct 3D correlations (not yet used here)
+8 −8
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ import javax.xml.bind.DatatypeConverter;
import Jama.Matrix;

public class IntersceneLma {
	OpticalFlow opticalFlow = null;
//	OpticalFlow opticalFlow = null;
	QuadCLT [] scenesCLT =    null; // now will use just 2 - 0 -reference scene, 1 - scene.  
	private double []         last_rms =        null; // {rms, rms_pure}, matching this.vector
	private double []         good_or_bad_rms = null; // just for diagnostics, to read last (failed) rms
@@ -37,11 +37,11 @@ public class IntersceneLma {
	private int               num_samples = 0;
	private boolean           thread_invariant = true; // Do not use DoubleAdder, provide results not dependent on threads
	public IntersceneLma(
			OpticalFlow opticalFlow,
//			OpticalFlow opticalFlow,
			boolean thread_invariant
			) {
		this.thread_invariant = thread_invariant;
		this.opticalFlow = opticalFlow;
//		this.opticalFlow = opticalFlow;
	}
	
	public double [][]       getLastJT(){
@@ -549,7 +549,7 @@ public class IntersceneLma {
	{
		this.weights = new double [num_samples + parameters_vector.length];
		
		final Thread[] threads = ImageDtt.newThreadArray(opticalFlow.threadsMax);
		final Thread[] threads = ImageDtt.newThreadArray(QuadCLT.THREADS_MAX);
		final AtomicInteger ai = new AtomicInteger(0);
		double sum_weights;
		if (thread_invariant) {
@@ -652,7 +652,7 @@ public class IntersceneLma {

	private void normalizeWeights()
	{
		final Thread[] threads = ImageDtt.newThreadArray(opticalFlow.threadsMax);
		final Thread[] threads = ImageDtt.newThreadArray(QuadCLT.THREADS_MAX);
		final AtomicInteger ai = new AtomicInteger(0);
		double full_weight, sum_weight_pure;
		if (thread_invariant) {
@@ -763,7 +763,7 @@ public class IntersceneLma {
				scene_atr, // double [] atr);
				false)[0]; // boolean invert));
		
		final Thread[] threads = ImageDtt.newThreadArray(opticalFlow.threadsMax);
		final Thread[] threads = ImageDtt.newThreadArray(QuadCLT.THREADS_MAX);
		final AtomicInteger ai = new AtomicInteger(0);
		for (int ithread = 0; ithread < threads.length; ithread++) {
			threads[ithread] = new Thread() {
@@ -840,7 +840,7 @@ public class IntersceneLma {
		final int num_pars2 = num_pars * num_pars;
		final int nup_points = jt[0].length;
		final double [][] wjtjl = new double [num_pars][num_pars];
		final Thread[] threads = ImageDtt.newThreadArray(opticalFlow.threadsMax);
		final Thread[] threads = ImageDtt.newThreadArray(QuadCLT.THREADS_MAX);
		final AtomicInteger ai = new AtomicInteger(0);
		for (int ithread = 0; ithread < threads.length; ithread++) {
			threads[ithread] = new Thread() {
@@ -876,7 +876,7 @@ public class IntersceneLma {
			final double []   fx,
			final double []   rms_fp // null or [2]
			) {
		final Thread[]      threads =     ImageDtt.newThreadArray(opticalFlow.threadsMax);
		final Thread[]      threads =     ImageDtt.newThreadArray(QuadCLT.THREADS_MAX);
		final AtomicInteger ai =          new AtomicInteger(0);
		final double []     wymfw =       new double [fx.length];
		double s_rms; 
+285 −56

File changed.

Preview size limit exceeded, changes collapsed.

+10 −10

File changed.

Preview size limit exceeded, changes collapsed.

+32 −12

File changed.

Preview size limit exceeded, changes collapsed.

Loading