diff options
Diffstat (limited to 'intern/smoke/intern/WAVELET_NOISE.h')
-rw-r--r-- | intern/smoke/intern/WAVELET_NOISE.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/intern/smoke/intern/WAVELET_NOISE.h b/intern/smoke/intern/WAVELET_NOISE.h index b556b4a2e66..edbf4254199 100644 --- a/intern/smoke/intern/WAVELET_NOISE.h +++ b/intern/smoke/intern/WAVELET_NOISE.h @@ -69,7 +69,7 @@ static void downsampleX(float *from, float *to, int n){ const float *a = &downCoeffs[16]; for (int i = 0; i < n / 2; i++) { to[i] = 0; - for (int k = 2 * i - 16; k <= 2 * i + 16; k++) + for (int k = 2 * i - 16; k < 2 * i + 16; k++) to[i] += a[k - 2 * i] * from[modFast128(k)]; } } @@ -79,7 +79,7 @@ static void downsampleY(float *from, float *to, int n){ const float *a = &downCoeffs[16]; for (int i = 0; i < n / 2; i++) { to[i * n] = 0; - for (int k = 2 * i - 16; k <= 2 * i + 16; k++) + for (int k = 2 * i - 16; k < 2 * i + 16; k++) to[i * n] += a[k - 2 * i] * from[modFast128(k) * n]; } } @@ -89,7 +89,7 @@ static void downsampleZ(float *from, float *to, int n){ const float *a = &downCoeffs[16]; for (int i = 0; i < n / 2; i++) { to[i * n * n] = 0; - for (int k = 2 * i - 16; k <= 2 * i + 16; k++) + for (int k = 2 * i - 16; k < 2 * i + 16; k++) to[i * n * n] += a[k - 2 * i] * from[modFast128(k) * n * n]; } } @@ -262,6 +262,14 @@ static bool loadTile(float* const noiseTileData, std::string filename) printf("loadTile: Noise tile '%s' is wrong size %d.\n", filename.c_str(), (int)bread); return false; } + + // check for invalid nan tile data that could be generated. bug is now + // fixed, but invalid files may still hang around + if (isnan(noiseTileData[0])) { + printf("loadTile: Noise tile '%s' contains nan values.\n", filename.c_str()); + return false; + } + return true; } |