Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/film.cpp
| Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static float filter_func_gaussian(float v, float width) | static float filter_func_gaussian(float v, float width) | ||||
| { | { | ||||
| v *= 2.0f/width; | v *= 2.0f/width; | ||||
| return expf(-2.0f*v*v); | return expf(-2.0f*v*v); | ||||
| } | } | ||||
| static float filter_func_blackman_harris(float v, float width) | |||||
| { | |||||
| v = M_2PI_F * (v / width + 0.5f); | |||||
| return 0.35875f - 0.48829f*cosf(v) + 0.14128f*cosf(2.0f*v) - 0.01168f*cosf(3.0f*v); | |||||
| } | |||||
| static vector<float> filter_table(FilterType type, float width) | static vector<float> filter_table(FilterType type, float width) | ||||
| { | { | ||||
| const int filter_table_size = FILTER_TABLE_SIZE-1; | const int filter_table_size = FILTER_TABLE_SIZE-1; | ||||
| vector<float> filter_table_cdf(filter_table_size+1); | vector<float> filter_table_cdf(filter_table_size+1); | ||||
| vector<float> filter_table(filter_table_size+1); | vector<float> filter_table(filter_table_size+1); | ||||
| float (*filter_func)(float, float) = NULL; | float (*filter_func)(float, float) = NULL; | ||||
| int i, half_size = filter_table_size/2; | int i, half_size = filter_table_size/2; | ||||
| switch(type) { | switch(type) { | ||||
| case FILTER_BOX: | case FILTER_BOX: | ||||
| filter_func = filter_func_box; | filter_func = filter_func_box; | ||||
| break; | break; | ||||
| case FILTER_GAUSSIAN: | case FILTER_GAUSSIAN: | ||||
| filter_func = filter_func_gaussian; | filter_func = filter_func_gaussian; | ||||
| break; | break; | ||||
| case FILTER_BLACKMAN_HARRIS: | |||||
| filter_func = filter_func_blackman_harris; | |||||
| width *= 2.0f; | |||||
sergey: Isn't this something we can compensate in the filter function? | |||||
lukasstockner97AuthorUnsubmitted Not Done Inline ActionsWe could, but it's also used below (line 264), so it'd need an additional condition down there. lukasstockner97: We could, but it's also used below (line 264), so it'd need an additional condition down there. | |||||
| break; | |||||
| default: | default: | ||||
| assert(0); | assert(0); | ||||
| } | } | ||||
| /* compute cumulative distribution function */ | /* compute cumulative distribution function */ | ||||
| filter_table_cdf[0] = 0.0f; | filter_table_cdf[0] = 0.0f; | ||||
| for(i = 0; i < filter_table_size; i++) { | for(i = 0; i < filter_table_size; i++) { | ||||
| ▲ Show 20 Lines • Show All 253 Lines • Show Last 20 Lines | |||||
Isn't this something we can compensate in the filter function?