Skip to content

Commit

Permalink
Use standard solver for now
Browse files Browse the repository at this point in the history
  • Loading branch information
brimson committed May 29, 2022
1 parent 89132ab commit e4a0fed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
8 changes: 3 additions & 5 deletions shaders/cMotionBlur.fx
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,7 @@ namespace Motion_Blur
// Solve linear equation for [U, V]
// [Ix^2+A IxIy] [U] = -[IxIt]
// [IxIy Iy^2+A] [V] = -[IyIt]
OpticalFlow.x = Aii.x * ((Alpha * UV.x) - (Aij * UV.y) - Bi.x);
OpticalFlow.y = Aii.y * ((Alpha * UV.y) - (Aij * OpticalFlow.x) - Bi.y);
OpticalFlow.xy = Aii.xy * ((Alpha * UV.xy) - (Aij * UV.yx) - Bi.xy);
}

void Gradient(in float4x2 Samples, out float Gradient)
Expand Down Expand Up @@ -510,7 +509,7 @@ namespace Motion_Blur
float2 GradA = FreiChenUV[0] + FreiChenUV[1] + FreiChenUV[2] + FreiChenUV[3];
float2 GradB = FreiChenUV[4] + FreiChenUV[5] + FreiChenUV[6] + FreiChenUV[7] + FreiChenUV[8];
float2 Grad = sqrt(GradA / (GradA + GradB + FP16_MINIMUM));
float CenterGradient = rsqrt((dot(Grad, Grad) + FP16_MINIMUM));
float CenterGradient = rsqrt(dot(Grad, Grad) + FP16_MINIMUM);

// Area smoothness gradients
// .............................
Expand Down Expand Up @@ -599,8 +598,7 @@ namespace Motion_Blur
// [IxIy Iy^2+A] [V] = -[IyIt]
UVAverage.xy = (AreaGrad.xx * AreaAvg[0]) + (AreaGrad.yy * AreaAvg[1]) + (AreaGrad.zz * AreaAvg[2]) + (AreaGrad.ww * AreaAvg[3]);
UVAverage.xy = UVAverage.xy * Alpha;
OpticalFlow.x = Aii.x * (UVAverage.x - (Aij * CenterAverage.y) - Bi.x);
OpticalFlow.y = Aii.y * (UVAverage.y - (Aij * OpticalFlow.x) - Bi.y);
OpticalFlow.xy = Aii.xy * (UVAverage.xy - (Aij * CenterAverage.yx) - Bi.xy);
}

#define LEVEL_PS(NAME, SAMPLER, LEVEL) \
Expand Down
8 changes: 3 additions & 5 deletions shaders/cOpticalFlow.fx
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,7 @@ namespace OpticalFlow
// Solve linear equation for [U, V]
// [Ix^2+A IxIy] [U] = -[IxIt]
// [IxIy Iy^2+A] [V] = -[IyIt]
OpticalFlow.x = Aii.x * ((Alpha * UV.x) - (Aij * UV.y) - Bi.x);
OpticalFlow.y = Aii.y * ((Alpha * UV.y) - (Aij * OpticalFlow.x) - Bi.y);
OpticalFlow.xy = Aii.xy * (UV.xy - (Aij * UV.yx) - Bi.xy);
}

void Gradient(in float4x2 Samples, out float Gradient)
Expand Down Expand Up @@ -554,7 +553,7 @@ namespace OpticalFlow
float2 GradA = FreiChenUV[0] + FreiChenUV[1] + FreiChenUV[2] + FreiChenUV[3];
float2 GradB = FreiChenUV[4] + FreiChenUV[5] + FreiChenUV[6] + FreiChenUV[7] + FreiChenUV[8];
float2 Grad = sqrt(GradA / (GradA + GradB + FP16_MINIMUM));
float CenterGradient = rsqrt((dot(Grad, Grad) + FP16_MINIMUM));
float CenterGradient = rsqrt(dot(Grad, Grad) + FP16_MINIMUM);

// Area smoothness gradients
// .............................
Expand Down Expand Up @@ -643,8 +642,7 @@ namespace OpticalFlow
// [IxIy Iy^2+A] [V] = -[IyIt]
UVAverage.xy = (AreaGrad.xx * AreaAvg[0]) + (AreaGrad.yy * AreaAvg[1]) + (AreaGrad.zz * AreaAvg[2]) + (AreaGrad.ww * AreaAvg[3]);
UVAverage.xy = UVAverage.xy * Alpha;
OpticalFlow.x = Aii.x * (UVAverage.x - (Aij * CenterAverage.y) - Bi.x);
OpticalFlow.y = Aii.y * (UVAverage.y - (Aij * OpticalFlow.x) - Bi.y);
OpticalFlow.xy = Aii.xy * (UVAverage.xy - (Aij * CenterAverage.yx) - Bi.xy);
}

#define LEVEL_PS(NAME, SAMPLER, LEVEL) \
Expand Down
8 changes: 3 additions & 5 deletions shaders/kDatamosh.fx
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,7 @@ namespace Datamosh
// Solve linear equation for [U, V]
// [Ix^2+A IxIy] [U] = -[IxIt]
// [IxIy Iy^2+A] [V] = -[IyIt]
OpticalFlow.x = Aii.x * ((Alpha * UV.x) - (Aij * UV.y) - Bi.x);
OpticalFlow.y = Aii.y * ((Alpha * UV.y) - (Aij * OpticalFlow.x) - Bi.y);
OpticalFlow.xy = Aii.xy * (UV.xy - (Aij * UV.yx) - Bi.xy);
}

void Gradient(in float4x2 Samples, out float Gradient)
Expand Down Expand Up @@ -517,7 +516,7 @@ namespace Datamosh
float2 GradA = FreiChenUV[0] + FreiChenUV[1] + FreiChenUV[2] + FreiChenUV[3];
float2 GradB = FreiChenUV[4] + FreiChenUV[5] + FreiChenUV[6] + FreiChenUV[7] + FreiChenUV[8];
float2 Grad = sqrt(GradA / (GradA + GradB + FP16_MINIMUM));
float CenterGradient = rsqrt((dot(Grad, Grad) + FP16_MINIMUM));
float CenterGradient = rsqrt(dot(Grad, Grad) + FP16_MINIMUM);

// Area smoothness gradients
// .............................
Expand Down Expand Up @@ -606,8 +605,7 @@ namespace Datamosh
// [IxIy Iy^2+A] [V] = -[IyIt]
UVAverage.xy = (AreaGrad.xx * AreaAvg[0]) + (AreaGrad.yy * AreaAvg[1]) + (AreaGrad.zz * AreaAvg[2]) + (AreaGrad.ww * AreaAvg[3]);
UVAverage.xy = UVAverage.xy * Alpha;
OpticalFlow.x = Aii.x * (UVAverage.x - (Aij * CenterAverage.y) - Bi.x);
OpticalFlow.y = Aii.y * (UVAverage.y - (Aij * OpticalFlow.x) - Bi.y);
OpticalFlow.xy = Aii.xy * (UVAverage.xy - (Aij * CenterAverage.yx) - Bi.xy);
}

#define LEVEL_PS(NAME, SAMPLER, LEVEL) \
Expand Down

0 comments on commit e4a0fed

Please sign in to comment.