Commit f1e78589 authored by Andrey Filippov's avatar Andrey Filippov

Fixed NaN when rendering with zero Motion Blur

parent a47aabbe
...@@ -3843,7 +3843,7 @@ public class GpuQuad{ // quad camera description ...@@ -3843,7 +3843,7 @@ public class GpuQuad{ // quad camera description
final int threadsMax) // maximal number of threads to launch final int threadsMax) // maximal number of threads to launch
{ {
final double min_sub = 1e-12; final double min_sub = 1e-12;
final double min_len = 0.1; // pix final double min_len = 0.001; // pix was 0.1
int num_pairs = Correlation2d.getNumPairs(num_cams); int num_pairs = Correlation2d.getNumPairs(num_cams);
//change to fixed 511? //change to fixed 511?
// final int task_code = ((1 << num_pairs)-1) << GPUTileProcessor.TASK_CORR_BITS; // correlation only // final int task_code = ((1 << num_pairs)-1) << GPUTileProcessor.TASK_CORR_BITS; // correlation only
...@@ -3895,18 +3895,17 @@ public class GpuQuad{ // quad camera description ...@@ -3895,18 +3895,17 @@ public class GpuQuad{ // quad camera description
// calculate offset for the secondary tile and weigh // calculate offset for the secondary tile and weigh
double dx = mb_vectors[0][nTile]; double dx = mb_vectors[0][nTile];
double dy = mb_vectors[1][nTile]; double dy = mb_vectors[1][nTile];
double mb_len = Math.sqrt(dx*dx+dy*dy); // in pixels/s double mb_len = Math.sqrt(dx*dx+dy*dy); // in pixels/s -> 0
dx /= mb_len; // unit vector
dy /= mb_len;
mb_len *= mb_tau; // now in pixels
/*
double [] centerXY_sub = centerXY; double [] centerXY_sub = centerXY;
if (mb_len < min_len) { if (mb_len < min_len) {
tp_task.setScale(1.0); tp_task.setScale(1.0);
tp_task_sub.task = 0; // disable tp_task_sub.task = 0; // disable
tp_task.setScale(-min_sub); tp_task_sub.setScale(-min_sub);
tp_task_sub.setCenterXY(centerXY);
} else { } else {
*/ dx /= mb_len; // unit vector
dy /= mb_len;
mb_len *= mb_tau; // now in pixels
double mb_offs = 1.0; // try 1 pixel. Maybe adjust for non-ortho, e.g. sqrt(2) for diagonal? double mb_offs = 1.0; // try 1 pixel. Maybe adjust for non-ortho, e.g. sqrt(2) for diagonal?
double min_offs = mb_len_scale * mb_len; double min_offs = mb_len_scale * mb_len;
if (mb_offs < min_offs) { if (mb_offs < min_offs) {
...@@ -3914,7 +3913,7 @@ public class GpuQuad{ // quad camera description ...@@ -3914,7 +3913,7 @@ public class GpuQuad{ // quad camera description
} }
dx *= mb_offs; dx *= mb_offs;
dy *= mb_offs; dy *= mb_offs;
double [] centerXY_sub = new double[] {centerXY[0]+dx,centerXY[1]+dy}; centerXY_sub = new double[] {centerXY[0]+dx,centerXY[1]+dy};
tp_task_sub.setCenterXY(centerXY_sub); tp_task_sub.setCenterXY(centerXY_sub);
double exp_offs = Math.exp(-mb_offs/mb_len); double exp_offs = Math.exp(-mb_offs/mb_len);
double gain = 1.0/(1.0 - exp_offs); double gain = 1.0/(1.0 - exp_offs);
...@@ -3924,7 +3923,7 @@ public class GpuQuad{ // quad camera description ...@@ -3924,7 +3923,7 @@ public class GpuQuad{ // quad camera description
} }
tp_task.setScale(gain); tp_task.setScale(gain);
tp_task_sub.setScale(gain_sub); tp_task_sub.setScale(gain_sub);
// } }
boolean bad_margins = false; boolean bad_margins = false;
if (calcPortsCoordinatesAndDerivatives) { // for non-GPU? if (calcPortsCoordinatesAndDerivatives) { // for non-GPU?
double [][] disp_dist = new double[quad_main][]; // used to correct 3D correlations (not yet used here) double [][] disp_dist = new double[quad_main][]; // used to correct 3D correlations (not yet used here)
......
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