Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/sobol.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | typedef struct SobolDirectionNumbers { | ||||
| uint d, s, a; | uint d, s, a; | ||||
| uint m[SOBOL_MAX_NUMBER]; | uint m[SOBOL_MAX_NUMBER]; | ||||
| } SobolDirectionNumbers; | } SobolDirectionNumbers; | ||||
| /* Note: this file is skipped by clang-format. */ | /* Note: this file is skipped by clang-format. */ | ||||
| /* Keep simple alignment. */ | /* Keep simple alignment. */ | ||||
| /* clang-format off */ | /* clang-format off */ | ||||
| static SobolDirectionNumbers SOBOL_NUMBERS[SOBOL_MAX_DIMENSIONS - 1] = { | static const SobolDirectionNumbers SOBOL_NUMBERS[SOBOL_MAX_DIMENSIONS - 1] = { | ||||
| {2, 1, 0, {1}}, | {2, 1, 0, {1}}, | ||||
| {3, 2, 1, {1, 3}}, | {3, 2, 1, {1, 3}}, | ||||
| {4, 3, 1, {1, 3, 1}}, | {4, 3, 1, {1, 3, 1}}, | ||||
| {5, 3, 2, {1, 1, 1}}, | {5, 3, 2, {1, 1, 1}}, | ||||
| {6, 4, 1, {1, 1, 3, 3}}, | {6, 4, 1, {1, 1, 3, 3}}, | ||||
| {7, 4, 4, {1, 3, 5, 13}}, | {7, 4, 4, {1, 3, 5, 13}}, | ||||
| {8, 5, 2, {1, 1, 5, 5, 17}}, | {8, 5, 2, {1, 1, 5, 5, 17}}, | ||||
| {9, 5, 4, {1, 1, 5, 5, 5}}, | {9, 5, 4, {1, 1, 5, 5, 5}}, | ||||
| ▲ Show 20 Lines • Show All 21,200 Lines • ▼ Show 20 Lines | void sobol_generate_direction_vectors(uint vectors[][SOBOL_BITS], int dimensions) | ||||
| /* first dimension is exception */ | /* first dimension is exception */ | ||||
| uint *v = vectors[0]; | uint *v = vectors[0]; | ||||
| for (uint i = 0; i < L; i++) | for (uint i = 0; i < L; i++) | ||||
| v[i] = 1 << (31 - i); // all m's = 1 | v[i] = 1 << (31 - i); // all m's = 1 | ||||
| for (int dim = 1; dim < dimensions; dim++) { | for (int dim = 1; dim < dimensions; dim++) { | ||||
| SobolDirectionNumbers *numbers = &SOBOL_NUMBERS[dim - 1]; | const SobolDirectionNumbers *numbers = &SOBOL_NUMBERS[dim - 1]; | ||||
| uint s = numbers->s; | const uint s = numbers->s; | ||||
| uint a = numbers->a; | const uint a = numbers->a; | ||||
| uint *m = numbers->m; | const uint *m = numbers->m; | ||||
| v = vectors[dim]; | v = vectors[dim]; | ||||
| if (L <= s) { | if (L <= s) { | ||||
| for (uint i = 0; i < L; i++) | for (uint i = 0; i < L; i++) | ||||
| v[i] = m[i] << (31 - i); | v[i] = m[i] << (31 - i); | ||||
| } | } | ||||
| else { | else { | ||||
| Show All 14 Lines | |||||