Skip to content

Commit

Permalink
Update cVideoProcessing.fxh
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Mar 31, 2024
1 parent ab0ecf2 commit 44cf65b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions shaders/shared/cVideoProcessing.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
const int Exponent = exp2(ExponentBits);
const int Significand = exp2(SignificandBits);

const float MaxExponent = (Exponent - exp2(1)) + Bias;
const float MaxExponent = ((float)Exponent - (float)exp2(1)) + (float)Bias;
const float MaxSignificand = 1.0 + (((float)Significand - 1.0) / (float)Significand);

return pow(-1, SignBit) * exp2(MaxExponent) * MaxSignificand;
return (float)pow(-1, SignBit) * (float)exp2(MaxExponent) * MaxSignificand;
}

// [-Half, Half] -> [-1.0, 1.0]
Expand Down Expand Up @@ -145,9 +145,12 @@
// Calculate A^T*B
float2 Flow = (D == 0.0) ? 0.0 : mul(B, A);

// Propagate motion vectors to Half format
// Propagate normalized motion vectors
Vectors += NormalizeMotionVectors(Flow, PixelSize);

// Clamp motion vectors to restrict range to valid lengths
Vectors = clamp(Vectors, -1.0, 1.0);

// Pack motion vectors to Half format
return PackMotionVectors(Vectors);
}
Expand Down

0 comments on commit 44cf65b

Please sign in to comment.