Skip to content

Commit

Permalink
exrmakepreview: switch preview-to-full scaling vars from floats to do…
Browse files Browse the repository at this point in the history
…ubles to prevent rounding causing overflows

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
  • Loading branch information
peterhillman committed Feb 4, 2020
1 parent 3eda5d7 commit 822e218
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions OpenEXR/exrmakepreview/makePreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ generatePreview (const char inFileName[],
previewHeight = max (int (h / (w * a) * previewWidth + .5f), 1);
previewPixels.resizeErase (previewHeight, previewWidth);

float fx = (previewWidth > 1)? (float (w - 1) / (previewWidth - 1)): 1;
float fy = (previewHeight > 1)? (float (h - 1) / (previewHeight - 1)): 1;
double fx = (previewWidth > 1)? (double (w - 1) / (previewWidth - 1)): 1;
double fy = (previewHeight > 1)? (double (h - 1) / (previewHeight - 1)): 1;
float m = Math<float>::pow (2.f, IMATH_NAMESPACE::clamp (exposure + 2.47393f, -20.f, 20.f));

for (int y = 0; y < previewHeight; ++y)
Expand Down

0 comments on commit 822e218

Please sign in to comment.