Skip to content

Commit

Permalink
MInor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
brimson committed May 25, 2022
1 parent 136ea74 commit 89132ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions shaders/cMotionBlur.fx
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,9 @@ namespace Motion_Blur
// [Ix^2+A IxIy] [U] = -[IxIt]
// [IxIy Iy^2+A] [V] = -[IyIt]
UVAverage.xy = (AreaGrad.xx * AreaAvg[0]) + (AreaGrad.yy * AreaAvg[1]) + (AreaGrad.zz * AreaAvg[2]) + (AreaGrad.ww * AreaAvg[3]);
OpticalFlow.x = Aii.x * ((Alpha * UVAverage.x) - (Aij * CenterAverage.y) - Bi.x);
OpticalFlow.y = Aii.y * ((Alpha * UVAverage.y) - (Aij * OpticalFlow.x) - Bi.y);
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);
}

#define LEVEL_PS(NAME, SAMPLER, LEVEL) \
Expand Down
5 changes: 3 additions & 2 deletions shaders/cOpticalFlow.fx
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,9 @@ namespace OpticalFlow
// [Ix^2+A IxIy] [U] = -[IxIt]
// [IxIy Iy^2+A] [V] = -[IyIt]
UVAverage.xy = (AreaGrad.xx * AreaAvg[0]) + (AreaGrad.yy * AreaAvg[1]) + (AreaGrad.zz * AreaAvg[2]) + (AreaGrad.ww * AreaAvg[3]);
OpticalFlow.x = Aii.x * ((Alpha * UVAverage.x) - (Aij * CenterAverage.y) - Bi.x);
OpticalFlow.y = Aii.y * ((Alpha * UVAverage.y) - (Aij * OpticalFlow.x) - Bi.y);
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);
}

#define LEVEL_PS(NAME, SAMPLER, LEVEL) \
Expand Down
5 changes: 3 additions & 2 deletions shaders/kDatamosh.fx
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,9 @@ namespace Datamosh
// [Ix^2+A IxIy] [U] = -[IxIt]
// [IxIy Iy^2+A] [V] = -[IyIt]
UVAverage.xy = (AreaGrad.xx * AreaAvg[0]) + (AreaGrad.yy * AreaAvg[1]) + (AreaGrad.zz * AreaAvg[2]) + (AreaGrad.ww * AreaAvg[3]);
OpticalFlow.x = Aii.x * ((Alpha * UVAverage.x) - (Aij * CenterAverage.y) - Bi.x);
OpticalFlow.y = Aii.y * ((Alpha * UVAverage.y) - (Aij * OpticalFlow.x) - Bi.y);
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);
}

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

0 comments on commit 89132ab

Please sign in to comment.