diff options
Diffstat (limited to 'source/blender/compositor/operations')
40 files changed, 193 insertions, 193 deletions
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cc b/source/blender/compositor/operations/COM_BlurBaseOperation.cc index b278997eced..53a5cebaf5d 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cc +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cc @@ -71,7 +71,7 @@ float *BlurBaseOperation::make_gausstab(float rad, int size) sum = 0.0f; float fac = (rad > 0.0f ? 1.0f / rad : 0.0f); for (i = -size; i <= size; i++) { - val = RE_filter_value(data_.filtertype, (float)i * fac); + val = RE_filter_value(data_.filtertype, float(i) * fac); sum += val; gausstab[i + size] = val; } @@ -107,7 +107,7 @@ float *BlurBaseOperation::make_dist_fac_inverse(float rad, int size, int falloff float fac = (rad > 0.0f ? 1.0f / rad : 0.0f); for (i = -size; i <= size; i++) { - val = 1.0f - fabsf((float)i * fac); + val = 1.0f - fabsf(float(i) * fac); /* keep in sync with rna_enum_proportional_falloff_curve_only_items */ switch (falloff) { diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cc b/source/blender/compositor/operations/COM_BokehImageOperation.cc index 42caa7aa3c0..9828d38d83f 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.cc +++ b/source/blender/compositor/operations/COM_BokehImageOperation.cc @@ -16,13 +16,13 @@ void BokehImageOperation::init_execution() center_[1] = get_height() / 2; inverse_rounding_ = 1.0f - data_->rounding; circular_distance_ = get_width() / 2; - flap_rad_ = (float)(M_PI * 2) / data_->flaps; + flap_rad_ = float(M_PI * 2) / data_->flaps; flap_rad_add_ = data_->angle; while (flap_rad_add_ < 0.0f) { - flap_rad_add_ += (float)(M_PI * 2.0); + flap_rad_add_ += float(M_PI * 2.0); } - while (flap_rad_add_ > (float)M_PI) { - flap_rad_add_ -= (float)(M_PI * 2.0); + while (flap_rad_add_ > float(M_PI)) { + flap_rad_add_ -= float(M_PI * 2.0); } } void BokehImageOperation::detemine_start_point_of_flap(float r[2], int flap_number, float distance) @@ -43,8 +43,8 @@ float BokehImageOperation::is_inside_bokeh(float distance, float x, float y) point[1] = y; const float distance_to_center = len_v2v2(point, center_); - const float bearing = (atan2f(deltaX, deltaY) + (float)(M_PI * 2.0)); - int flap_number = (int)((bearing - flap_rad_add_) / flap_rad_); + const float bearing = (atan2f(deltaX, deltaY) + float(M_PI * 2.0)); + int flap_number = int((bearing - flap_rad_add_) / flap_rad_); detemine_start_point_of_flap(line_p1, flap_number, distance); detemine_start_point_of_flap(line_p2, flap_number + 1, distance); diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cc b/source/blender/compositor/operations/COM_BoxMaskOperation.cc index 5b3e00afe31..85ac9434647 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cc +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cc @@ -19,10 +19,10 @@ void BoxMaskOperation::init_execution() { input_mask_ = this->get_input_socket_reader(0); input_value_ = this->get_input_socket_reader(1); - const double rad = (double)data_->rotation; + const double rad = double(data_->rotation); cosine_ = cos(rad); sine_ = sin(rad); - aspect_ratio_ = ((float)this->get_width()) / this->get_height(); + aspect_ratio_ = float(this->get_width()) / this->get_height(); } void BoxMaskOperation::execute_pixel_sampled(float output[4], diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc index 881b894d66d..95acf51413c 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc @@ -74,7 +74,7 @@ void *CalculateStandardDeviationOperation::initialize_tile_data(rcti *rect) } } } - standard_deviation_ = sqrt(sum / (float)(pixels - 1)); + standard_deviation_ = sqrt(sum / float(pixels - 1)); iscalculated_ = true; } unlock_mutex(); @@ -98,7 +98,7 @@ void CalculateStandardDeviationOperation::update_memory_buffer_started( join.num_pixels += chunk.num_pixels; }); standard_deviation_ = total.num_pixels <= 1 ? 0.0f : - sqrt(total.sum / (float)(total.num_pixels - 1)); + sqrt(total.sum / float(total.num_pixels - 1)); iscalculated_ = true; } } diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc index 89c1c7cb153..25d4b2d6a6c 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc @@ -46,8 +46,8 @@ void ConvertDepthToRadiusOperation::init_execution() } inverse_focal_distance_ = 1.0f / focal_distance; aspect_ = (this->get_width() > this->get_height()) ? - (this->get_height() / (float)this->get_width()) : - (this->get_width() / (float)this->get_height()); + (this->get_height() / float(this->get_width())) : + (this->get_width() / float(this->get_height())); aperture_ = 0.5f * (cam_lens_ / (aspect_ * cam_sensor)) / f_stop_; const float minsz = MIN2(get_width(), get_height()); dof_sp_ = minsz / ((cam_sensor / 2.0f) / diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.cc b/source/blender/compositor/operations/COM_CryptomatteOperation.cc index 69218576237..71e892cb7f1 100644 --- a/source/blender/compositor/operations/COM_CryptomatteOperation.cc +++ b/source/blender/compositor/operations/COM_CryptomatteOperation.cc @@ -42,8 +42,8 @@ void CryptomatteOperation::execute_pixel(float output[4], int x, int y, void *da ::memcpy(&m3hash, &input[0], sizeof(uint32_t)); /* Since the red channel is likely to be out of display range, * setting green and blue gives more meaningful images. */ - output[1] = ((float)(m3hash << 8) / (float)UINT32_MAX); - output[2] = ((float)(m3hash << 16) / (float)UINT32_MAX); + output[1] = (float(m3hash << 8) / float(UINT32_MAX)); + output[2] = (float(m3hash << 16) / float(UINT32_MAX)); } for (float hash : object_index_) { if (input[0] == hash) { @@ -71,8 +71,8 @@ void CryptomatteOperation::update_memory_buffer_partial(MemoryBuffer *output, ::memcpy(&m3hash, &input[0], sizeof(uint32_t)); /* Since the red channel is likely to be out of display range, * setting green and blue gives more meaningful images. */ - it.out[1] = ((float)(m3hash << 8) / (float)UINT32_MAX); - it.out[2] = ((float)(m3hash << 16) / (float)UINT32_MAX); + it.out[1] = (float(m3hash << 8) / float(UINT32_MAX)); + it.out[2] = (float(m3hash << 16) / float(UINT32_MAX)); } for (const float hash : object_index_) { if (input[0] == hash) { diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.cc b/source/blender/compositor/operations/COM_DenoiseOperation.cc index 3f32eced0f8..123f33d3c9e 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.cc +++ b/source/blender/compositor/operations/COM_DenoiseOperation.cc @@ -178,7 +178,7 @@ static bool are_guiding_passes_noise_free(const NodeDenoise *settings) void DenoiseOperation::hash_output_params() { if (settings_) { - hash_params((int)settings_->hdr, are_guiding_passes_noise_free(settings_)); + hash_params(int(settings_->hdr), are_guiding_passes_noise_free(settings_)); } } diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.cc b/source/blender/compositor/operations/COM_DespeckleOperation.cc index cfc437a6324..a0c82ad531c 100644 --- a/source/blender/compositor/operations/COM_DespeckleOperation.cc +++ b/source/blender/compositor/operations/COM_DespeckleOperation.cc @@ -99,7 +99,7 @@ void DespeckleOperation::execute_pixel(float output[4], int x, int y, void * /*d input_operation_->read(in1, x3, y3, nullptr); COLOR_ADD(TOT_DIV_CNR) - mul_v4_fl(color_mid, 1.0f / (4.0f + (4.0f * (float)M_SQRT1_2))); + mul_v4_fl(color_mid, 1.0f / (4.0f + (4.0f * float(M_SQRT1_2)))); // mul_v4_fl(color_mid, 1.0f / w); if ((w != 0.0f) && ((w / WTOT) > (threshold_neighbor_)) && @@ -214,7 +214,7 @@ void DespeckleOperation::update_memory_buffer_partial(MemoryBuffer *output, in1 = image->get_elem(x3, y3); COLOR_ADD(TOT_DIV_CNR) - mul_v4_fl(color_mid, 1.0f / (4.0f + (4.0f * (float)M_SQRT1_2))); + mul_v4_fl(color_mid, 1.0f / (4.0f + (4.0f * float(M_SQRT1_2)))); // mul_v4_fl(color_mid, 1.0f / w); if ((w != 0.0f) && ((w / WTOT) > (threshold_neighbor_)) && diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cc b/source/blender/compositor/operations/COM_DilateErodeOperation.cc index a93571ebee4..9a2d5e09b33 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cc +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cc @@ -181,8 +181,8 @@ static float get_min_distance(DilateErodeThresholdOperation::PixelData &p) * true. */ const TCompare compare; float min_dist = p.distance; - const float *row = p.elem + ((intptr_t)p.ymin - p.y) * p.row_stride + - ((intptr_t)p.xmin - p.x) * p.elem_stride; + const float *row = p.elem + (intptr_t(p.ymin) - p.y) * p.row_stride + + (intptr_t(p.xmin) - p.x) * p.elem_stride; for (int yi = p.ymin; yi < p.ymax; yi++) { const float dy = yi - p.y; const float dist_y = dy * dy; @@ -410,8 +410,8 @@ static float get_distance_value(DilateDistanceOperation::PixelData &p, const flo const TCompare compare; const float min_dist = p.min_distance; float value = start_value; - const float *row = p.elem + ((intptr_t)p.ymin - p.y) * p.row_stride + - ((intptr_t)p.xmin - p.x) * p.elem_stride; + const float *row = p.elem + (intptr_t(p.ymin) - p.y) * p.row_stride + + (intptr_t(p.xmin) - p.x) * p.elem_stride; for (int yi = p.ymin; yi < p.ymax; yi++) { const float dy = yi - p.y; const float dist_y = dy * dy; diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc index 37e05de33db..31ff3b5f4a2 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc @@ -30,7 +30,7 @@ void DirectionalBlurOperation::init_execution() const float height = get_height(); const float a = angle; - const float itsc = 1.0f / powf(2.0f, (float)iterations); + const float itsc = 1.0f / powf(2.0f, float(iterations)); float D; D = distance * sqrtf(width * width + height * height); diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cc b/source/blender/compositor/operations/COM_DisplaceOperation.cc index 198cca0482e..bbc8c09e866 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cc +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cc @@ -113,7 +113,7 @@ void DisplaceOperation::pixel_transform(const float xy[2], float r_uv[2], float num++; } if (num > 0) { - float numinv = 1.0f / (float)num; + float numinv = 1.0f / float(num); r_deriv[0][0] *= numinv; r_deriv[1][0] *= numinv; } @@ -130,7 +130,7 @@ void DisplaceOperation::pixel_transform(const float xy[2], float r_uv[2], float num++; } if (num > 0) { - float numinv = 1.0f / (float)num; + float numinv = 1.0f / float(num); r_deriv[0][1] *= numinv; r_deriv[1][1] *= numinv; } @@ -227,7 +227,7 @@ void DisplaceOperation::update_memory_buffer_partial(MemoryBuffer *output, { const MemoryBuffer *input_color = inputs[0]; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { - const float xy[2] = {(float)it.x, (float)it.y}; + const float xy[2] = {float(it.x), float(it.y)}; float uv[2]; float deriv[2][2]; diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc index 508e5ea5712..064163801ea 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc @@ -19,10 +19,10 @@ void EllipseMaskOperation::init_execution() { input_mask_ = this->get_input_socket_reader(0); input_value_ = this->get_input_socket_reader(1); - const double rad = (double)data_->rotation; + const double rad = double(data_->rotation); cosine_ = cos(rad); sine_ = sin(rad); - aspect_ratio_ = ((float)this->get_width()) / this->get_height(); + aspect_ratio_ = float(this->get_width()) / this->get_height(); } void EllipseMaskOperation::execute_pixel_sampled(float output[4], diff --git a/source/blender/compositor/operations/COM_FlipOperation.cc b/source/blender/compositor/operations/COM_FlipOperation.cc index 369f124622a..3d9d574b89d 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cc +++ b/source/blender/compositor/operations/COM_FlipOperation.cc @@ -26,8 +26,8 @@ void FlipOperation::deinit_execution() void FlipOperation::execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) { - float nx = flip_x_ ? ((int)this->get_width() - 1) - x : x; - float ny = flip_y_ ? ((int)this->get_height() - 1) - y : y; + float nx = flip_x_ ? (int(this->get_width()) - 1) - x : x; + float ny = flip_y_ ? (int(this->get_height()) - 1) - y : y; input_operation_->read_sampled(output, nx, ny, sampler); } @@ -39,7 +39,7 @@ bool FlipOperation::determine_depending_area_of_interest(rcti *input, rcti new_input; if (flip_x_) { - const int w = (int)this->get_width() - 1; + const int w = int(this->get_width()) - 1; new_input.xmax = (w - input->xmin) + 1; new_input.xmin = (w - input->xmax) - 1; } @@ -48,7 +48,7 @@ bool FlipOperation::determine_depending_area_of_interest(rcti *input, new_input.xmax = input->xmax; } if (flip_y_) { - const int h = (int)this->get_height() - 1; + const int h = int(this->get_height()) - 1; new_input.ymax = (h - input->ymin) + 1; new_input.ymin = (h - input->ymax) - 1; } @@ -85,7 +85,7 @@ void FlipOperation::get_area_of_interest(const int input_idx, BLI_assert(input_idx == 0); UNUSED_VARS_NDEBUG(input_idx); if (flip_x_) { - const int w = (int)this->get_width() - 1; + const int w = int(this->get_width()) - 1; r_input_area.xmax = (w - output_area.xmin) + 1; r_input_area.xmin = (w - output_area.xmax) + 1; } @@ -94,7 +94,7 @@ void FlipOperation::get_area_of_interest(const int input_idx, r_input_area.xmax = output_area.xmax; } if (flip_y_) { - const int h = (int)this->get_height() - 1; + const int h = int(this->get_height()) - 1; r_input_area.ymax = (h - output_area.ymin) + 1; r_input_area.ymin = (h - output_area.ymax) + 1; } @@ -112,8 +112,8 @@ void FlipOperation::update_memory_buffer_partial(MemoryBuffer *output, const int input_offset_x = input_img->get_rect().xmin; const int input_offset_y = input_img->get_rect().ymin; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { - const int nx = flip_x_ ? ((int)this->get_width() - 1) - it.x : it.x; - const int ny = flip_y_ ? ((int)this->get_height() - 1) - it.y : it.y; + const int nx = flip_x_ ? (int(this->get_width()) - 1) - it.x : it.x; + const int ny = flip_y_ ? (int(this->get_height()) - 1) - it.y : it.y; input_img->read_elem(input_offset_x + nx, input_offset_y + ny, it.out); } } diff --git a/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.cc b/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.cc index f380abf42f0..75b2249b6a7 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.cc @@ -114,7 +114,7 @@ void GaussianAlphaBlurBaseOperation::update_memory_buffer_partial(MemoryBuffer * float distfacinv_max = 1.0f; /* 0 to 1 */ const int step = QualityStepHelper::get_step(); - const float *in = it.in(0) + ((intptr_t)coord_min - coord) * elem_stride; + const float *in = it.in(0) + (intptr_t(coord_min) - coord) * elem_stride; const int in_stride = elem_stride * step; int index = (coord_min - coord) + filtersize_; const int index_end = index + (coord_max - coord_min); diff --git a/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.cc b/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.cc index 3c66f74f284..b2b10e77012 100644 --- a/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.cc @@ -112,7 +112,7 @@ void GaussianBlurBaseOperation::update_memory_buffer_partial(MemoryBuffer *outpu float multiplier_accum = 0.0f; const int step = QualityStepHelper::get_step(); - const float *in = it.in(0) + ((intptr_t)coord_min - coord) * elem_stride; + const float *in = it.in(0) + (intptr_t(coord_min) - coord) * elem_stride; const int in_stride = elem_stride * step; int gauss_idx = (coord_min - coord) + filtersize_; const int gauss_end = gauss_idx + (coord_max - coord_min); diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc index fa45034b00c..039e6a9bcc0 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc @@ -35,11 +35,11 @@ void GaussianBokehBlurOperation::init_data() } } - radxf_ = size_ * (float)data_.sizex; + radxf_ = size_ * float(data_.sizex); CLAMP(radxf_, 0.0f, width / 2.0f); /* Vertical. */ - radyf_ = size_ * (float)data_.sizey; + radyf_ = size_ * float(data_.sizey); CLAMP(radyf_, 0.0f, height / 2.0f); radx_ = ceil(radxf_); @@ -71,8 +71,8 @@ void GaussianBokehBlurOperation::update_gauss() float facy = (radyf_ > 0.0f ? 1.0f / radyf_ : 0.0f); for (int j = -rady_; j <= rady_; j++) { for (int i = -radx_; i <= radx_; i++, dgauss++) { - float fj = (float)j * facy; - float fi = (float)i * facx; + float fj = float(j) * facy; + float fi = float(i) * facx; float dist = sqrt(fj * fj + fi * fi); *dgauss = RE_filter_value(data_.filtertype, dist); @@ -105,10 +105,10 @@ void GaussianBokehBlurOperation::execute_pixel(float output[4], int x, int y, vo const float width = this->get_width(); const float height = this->get_height(); - radxf_ = size_ * (float)data_.sizex; + radxf_ = size_ * float(data_.sizex); CLAMP(radxf_, 0.0f, width / 2.0f); - radyf_ = size_ * (float)data_.sizey; + radyf_ = size_ * float(data_.sizey); CLAMP(radyf_, 0.0f, height / 2.0f); radx_ = ceil(radxf_); @@ -265,22 +265,22 @@ void GaussianBlurReferenceOperation::init_data() if (data_.relative) { switch (data_.aspect) { case CMP_NODE_BLUR_ASPECT_NONE: - data_.sizex = (int)(data_.percentx * 0.01f * data_.image_in_width); - data_.sizey = (int)(data_.percenty * 0.01f * data_.image_in_height); + data_.sizex = int(data_.percentx * 0.01f * data_.image_in_width); + data_.sizey = int(data_.percenty * 0.01f * data_.image_in_height); break; case CMP_NODE_BLUR_ASPECT_Y: - data_.sizex = (int)(data_.percentx * 0.01f * data_.image_in_width); - data_.sizey = (int)(data_.percenty * 0.01f * data_.image_in_width); + data_.sizex = int(data_.percentx * 0.01f * data_.image_in_width); + data_.sizey = int(data_.percenty * 0.01f * data_.image_in_width); break; case CMP_NODE_BLUR_ASPECT_X: - data_.sizex = (int)(data_.percentx * 0.01f * data_.image_in_height); - data_.sizey = (int)(data_.percenty * 0.01f * data_.image_in_height); + data_.sizex = int(data_.percentx * 0.01f * data_.image_in_height); + data_.sizey = int(data_.percenty * 0.01f * data_.image_in_height); break; } } /* Horizontal. */ - filtersizex_ = (float)data_.sizex; + filtersizex_ = float(data_.sizex); int imgx = get_width() / 2; if (filtersizex_ > imgx) { filtersizex_ = imgx; @@ -288,10 +288,10 @@ void GaussianBlurReferenceOperation::init_data() else if (filtersizex_ < 1) { filtersizex_ = 1; } - radx_ = (float)filtersizex_; + radx_ = float(filtersizex_); /* Vertical. */ - filtersizey_ = (float)data_.sizey; + filtersizey_ = float(data_.sizey); int imgy = get_height() / 2; if (filtersizey_ > imgy) { filtersizey_ = imgy; @@ -299,7 +299,7 @@ void GaussianBlurReferenceOperation::init_data() else if (filtersizey_ < 1) { filtersizey_ = 1; } - rady_ = (float)filtersizey_; + rady_ = float(filtersizey_); } void *GaussianBlurReferenceOperation::initialize_tile_data(rcti * /*rect*/) @@ -340,8 +340,8 @@ void GaussianBlurReferenceOperation::execute_pixel(float output[4], int x, int y float temp_size[4]; input_size_->read(temp_size, x, y, data); float ref_size = temp_size[0]; - int refradx = (int)(ref_size * radx_); - int refrady = (int)(ref_size * rady_); + int refradx = int(ref_size * radx_); + int refrady = int(ref_size * rady_); if (refradx > filtersizex_) { refradx = filtersizex_; } @@ -447,8 +447,8 @@ void GaussianBlurReferenceOperation::update_memory_buffer_partial(MemoryBuffer * MemoryBuffer *size_input = inputs[SIZE_INPUT_INDEX]; for (BuffersIterator<float> it = output->iterate_with({size_input}, area); !it.is_end(); ++it) { const float ref_size = *it.in(0); - int ref_radx = (int)(ref_size * radx_); - int ref_rady = (int)(ref_size * rady_); + int ref_radx = int(ref_size * radx_); + int ref_rady = int(ref_size * rady_); if (ref_radx > filtersizex_) { ref_radx = filtersizex_; } diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc index 5c4d470bc35..4f7b1be9057 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc @@ -75,8 +75,8 @@ static void FHT(fREAL *data, uint M, uint inverse) fREAL *data_nbd = &data_n[bd]; fREAL *data_bd = &data[bd]; for (k = bl; k < len; k += istep) { - t1 = fc * (double)data_n[k] + fs * (double)data_nbd[k]; - t2 = fs * (double)data_n[k] - fc * (double)data_nbd[k]; + t1 = fc * double(data_n[k]) + fs * double(data_nbd[k]); + t2 = fs * double(data_n[k]) - fc * double(data_nbd[k]); data_n[k] = data[k] - t1; data_nbd[k] = data_bd[k] - t2; data[k] += t1; @@ -360,14 +360,14 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) /* Data again transposed, so in order again. */ /* Overlap-add result. */ - for (y = 0; y < (int)h2; y++) { + for (y = 0; y < int(h2); y++) { const int yy = ybl * ybsz + y - hh; if ((yy < 0) || (yy >= image_height)) { continue; } fp = &data2[y * w2]; colp = (fRGB *)&rdst->get_buffer()[yy * image_width * COM_DATA_TYPE_COLOR_CHANNELS]; - for (x = 0; x < (int)w2; x++) { + for (x = 0; x < int(w2); x++) { const int xx = xbl * xbsz + x - hw; if ((xx < 0) || (xx >= image_width)) { continue; @@ -405,12 +405,12 @@ void GlareFogGlowOperation::generate_glare(float *data, BLI_rcti_init(&kernel_rect, 0, sz, 0, sz); ckrn = new MemoryBuffer(DataType::Color, kernel_rect); - scale = 0.25f * sqrtf((float)(sz * sz)); + scale = 0.25f * sqrtf(float(sz * sz)); for (y = 0; y < sz; y++) { - v = 2.0f * (y / (float)sz) - 1.0f; + v = 2.0f * (y / float(sz)) - 1.0f; for (x = 0; x < sz; x++) { - u = 2.0f * (x / (float)sz) - 1.0f; + u = 2.0f * (x / float(sz)) - 1.0f; r = (u * u + v * v) * scale; d = -sqrtf(sqrtf(sqrtf(r))) * 9.0f; fcol[0] = expf(d * cs_r); @@ -419,7 +419,7 @@ void GlareFogGlowOperation::generate_glare(float *data, /* Linear window good enough here, visual result counts, not scientific analysis: * `w = (1.0f-fabs(u))*(1.0f-fabs(v));` * actually, Hanning window is ok, `cos^2` for some reason is slower. */ - w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI)); + w = (0.5f + 0.5f * cosf(u * float(M_PI))) * (0.5f + 0.5f * cosf(v * float(M_PI))); mul_v3_fl(fcol, w); ckrn->write_pixel(x, y, fcol); } diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cc b/source/blender/compositor/operations/COM_GlareGhostOperation.cc index 13b7af2329e..5ba0901231d 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.cc +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cc @@ -23,7 +23,7 @@ void GlareGhostOperation::generate_glare(float *data, const NodeGlare *settings) { const int qt = 1 << settings->quality; - const float s1 = 4.0f / (float)qt, s2 = 2.0f * s1; + const float s1 = 4.0f / float(qt), s2 = 2.0f * s1; int x, y, n, p, np; fRGB c, tc, cm[64]; float sc, isc, u, v, sm, s, t, ofs, scalef[64]; @@ -79,7 +79,7 @@ void GlareGhostOperation::generate_glare(float *data, if (y == 3) { fRGB_rgbmult(cm[x], cmo, 1.0f, cmo); } - scalef[x] = 2.1f * (1.0f - (x + ofs) / (float)(settings->iter * 4)); + scalef[x] = 2.1f * (1.0f - (x + ofs) / float(settings->iter * 4)); if (x & 1) { scalef[x] = -0.99f / scalef[x]; } @@ -88,9 +88,9 @@ void GlareGhostOperation::generate_glare(float *data, sc = 2.13; isc = -0.97; for (y = 0; y < gbuf.get_height() && (!breaked); y++) { - v = ((float)y + 0.5f) / (float)gbuf.get_height(); + v = (float(y) + 0.5f) / float(gbuf.get_height()); for (x = 0; x < gbuf.get_width(); x++) { - u = ((float)x + 0.5f) / (float)gbuf.get_width(); + u = (float(x) + 0.5f) / float(gbuf.get_width()); s = (u - 0.5f) * sc + 0.5f; t = (v - 0.5f) * sc + 0.5f; tbuf1.read_bilinear(c, s * gbuf.get_width(), t * gbuf.get_height()); @@ -114,9 +114,9 @@ void GlareGhostOperation::generate_glare(float *data, tbuf1.get_width() * tbuf1.get_height() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); for (n = 1; n < settings->iter && (!breaked); n++) { for (y = 0; y < gbuf.get_height() && (!breaked); y++) { - v = ((float)y + 0.5f) / (float)gbuf.get_height(); + v = (float(y) + 0.5f) / float(gbuf.get_height()); for (x = 0; x < gbuf.get_width(); x++) { - u = ((float)x + 0.5f) / (float)gbuf.get_width(); + u = (float(x) + 0.5f) / float(gbuf.get_width()); tc[0] = tc[1] = tc[2] = 0.0f; for (p = 0; p < 4; p++) { np = (n << 2) + p; diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc index 8c303ab6332..c544e13cf34 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc @@ -12,7 +12,7 @@ void GlareStreaksOperation::generate_glare(float *data, int x, y, n; uint nump = 0; float c1[4], c2[4], c3[4], c4[4]; - float a, ang = DEG2RADF(360.0f) / (float)settings->streaks; + float a, ang = DEG2RADF(360.0f) / float(settings->streaks); int size = input_tile->get_width() * input_tile->get_height(); int size4 = size * 4; @@ -26,14 +26,14 @@ void GlareStreaksOperation::generate_glare(float *data, for (a = 0.0f; a < DEG2RADF(360.0f) && (!breaked); a += ang) { const float an = a + settings->angle_ofs; - const float vx = cos((double)an), vy = sin((double)an); + const float vx = cos(double(an)), vy = sin(double(an)); for (n = 0; n < settings->iter && (!breaked); n++) { - const float p4 = pow(4.0, (double)n); + const float p4 = pow(4.0, double(n)); const float vxp = vx * p4, vyp = vy * p4; - const float wt = pow((double)settings->fade, (double)p4); + const float wt = pow(double(settings->fade), double(p4)); /* Color-modulation amount relative to current pass. */ - const float cmo = 1.0f - (float)pow((double)settings->colmod, (double)n + 1); + const float cmo = 1.0f - float(pow(double(settings->colmod), double(n) + 1)); float *tdstcol = tdst.get_buffer(); for (y = 0; y < tsrc.get_height() && (!breaked); y++) { @@ -72,7 +72,7 @@ void GlareStreaksOperation::generate_glare(float *data, } float *sourcebuffer = tsrc.get_buffer(); - float factor = 1.0f / (float)(6 - settings->iter); + float factor = 1.0f / float(6 - settings->iter); for (int i = 0; i < size4; i += 4) { madd_v3_v3fl(&data[i], &sourcebuffer[i], factor); data[i + 3] = 1.0f; diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.cc b/source/blender/compositor/operations/COM_KeyingBlurOperation.cc index 71699f23a4b..4ae11c04506 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.cc @@ -48,7 +48,7 @@ void KeyingBlurOperation::execute_pixel(float output[4], int x, int y, void *dat } } - average /= (float)count; + average /= float(count); output[0] = average; } diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cc b/source/blender/compositor/operations/COM_KeyingClipOperation.cc index bb951aaa938..2cbdfaa6a01 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cc @@ -47,7 +47,7 @@ void KeyingClipOperation::execute_pixel(float output[4], int x, int y, void *dat end_y = min_ff(y + delta - 1, buffer_height - 1); int count = 0, total_count = (end_x - start_x + 1) * (end_y - start_y + 1) - 1; - int threshold_count = ceil((float)total_count * 0.9f); + int threshold_count = ceil(float(total_count) * 0.9f); if (delta == 0) { ok = true; @@ -147,7 +147,7 @@ void KeyingClipOperation::update_memory_buffer_partial(MemoryBuffer *output, const int y_len = end_y - start_y; const int total_count = x_len * y_len - 1; - const int threshold_count = ceil((float)total_count * 0.9f); + const int threshold_count = ceil(float(total_count) * 0.9f); bool ok = false; if (delta == 0) { ok = true; diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc index c037a1e0330..5c5bf5534a7 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc @@ -152,9 +152,9 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::build_voronoi_t else { uchar *rrgb = (uchar *)pattern_ibuf->rect; - site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f); - site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f); - site->color[2] += srgb_to_linearrgb((float)rrgb[4 * j + 2] / 255.0f); + site->color[0] += srgb_to_linearrgb(float(rrgb[4 * j + 0]) / 255.0f); + site->color[1] += srgb_to_linearrgb(float(rrgb[4 * j + 1]) / 255.0f); + site->color[2] += srgb_to_linearrgb(float(rrgb[4 * j + 2]) / 255.0f); } } @@ -204,11 +204,11 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::build_voronoi_t minmax_v2v2_v2(min, max, b->co); minmax_v2v2_v2(min, max, c->co); - rect->xmin = (int)min[0]; - rect->ymin = (int)min[1]; + rect->xmin = int(min[0]); + rect->ymin = int(min[1]); - rect->xmax = (int)max[0] + 1; - rect->ymax = (int)max[1] + 1; + rect->xmax = int(max[0]) + 1; + rect->ymax = int(max[1]) + 1; } } @@ -311,7 +311,7 @@ void KeyingScreenOperation::execute_pixel(float output[4], int x, int y, void *d TriangulationData *triangulation = cached_triangulation_; TileData *tile_data = (TileData *)data; int i; - float co[2] = {(float)x, (float)y}; + float co[2] = {float(x), float(y)}; for (i = 0; i < tile_data->triangles_total; i++) { int triangle_idx = tile_data->triangles[i]; @@ -356,7 +356,7 @@ void KeyingScreenOperation::update_memory_buffer_partial(MemoryBuffer *output, for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { copy_v4_v4(it.out, COM_COLOR_BLACK); - const float co[2] = {(float)it.x, (float)it.y}; + const float co[2] = {float(it.x), float(it.y)}; for (int i = 0; i < num_triangles; i++) { const int triangle_idx = triangles[i]; const rcti *rect = &triangulation->triangles_AABB[triangle_idx]; diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cc b/source/blender/compositor/operations/COM_MapUVOperation.cc index 40f91a04134..e6899949528 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cc +++ b/source/blender/compositor/operations/COM_MapUVOperation.cc @@ -124,7 +124,7 @@ void MapUVOperation::pixel_transform(const float xy[2], num++; } if (num > 0) { - float numinv = 1.0f / (float)num; + float numinv = 1.0f / float(num); r_deriv[0][0] *= numinv; r_deriv[1][0] *= numinv; } @@ -141,7 +141,7 @@ void MapUVOperation::pixel_transform(const float xy[2], num++; } if (num > 0) { - float numinv = 1.0f / (float)num; + float numinv = 1.0f / float(num); r_deriv[0][1] *= numinv; r_deriv[1][1] *= numinv; } @@ -217,7 +217,7 @@ void MapUVOperation::update_memory_buffer_partial(MemoryBuffer *output, { const MemoryBuffer *input_image = inputs[IMAGE_INPUT_INDEX]; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { - float xy[2] = {(float)it.x, (float)it.y}; + float xy[2] = {float(it.x), float(it.y)}; float uv[2]; float deriv[2][2]; float alpha; diff --git a/source/blender/compositor/operations/COM_MaskOperation.cc b/source/blender/compositor/operations/COM_MaskOperation.cc index 5517306f1af..d8b7c52d9d7 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cc +++ b/source/blender/compositor/operations/COM_MaskOperation.cc @@ -33,7 +33,7 @@ void MaskOperation::init_execution() } else { /* make a throw away copy of the mask */ - const float frame = (float)frame_number_ - frame_shutter_; + const float frame = float(frame_number_) - frame_shutter_; const float frame_step = (frame_shutter_ * 2.0f) / raster_mask_handle_tot_; float frame_iter = frame; diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cc b/source/blender/compositor/operations/COM_MovieDistortionOperation.cc index ea3aad20792..b89a48f2a39 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cc @@ -81,10 +81,10 @@ void MovieDistortionOperation::execute_pixel_sampled(float output[4], if (distortion_ != nullptr) { /* float overscan = 0.0f; */ const float pixel_aspect = pixel_aspect_; - const float w = (float)this->get_width() /* / (1 + overscan) */; - const float h = (float)this->get_height() /* / (1 + overscan) */; - const float aspx = w / (float)calibration_width_; - const float aspy = h / (float)calibration_height_; + const float w = float(this->get_width()) /* / (1 + overscan) */; + const float h = float(this->get_height()) /* / (1 + overscan) */; + const float aspx = w / float(calibration_width_); + const float aspy = h / float(calibration_height_); float in[2]; float out[2]; @@ -143,10 +143,10 @@ void MovieDistortionOperation::update_memory_buffer_partial(MemoryBuffer *output /* `float overscan = 0.0f;` */ const float pixel_aspect = pixel_aspect_; - const float w = (float)this->get_width() /* `/ (1 + overscan)` */; - const float h = (float)this->get_height() /* `/ (1 + overscan)` */; - const float aspx = w / (float)calibration_width_; - const float aspy = h / (float)calibration_height_; + const float w = float(this->get_width()) /* `/ (1 + overscan)` */; + const float h = float(this->get_height()) /* `/ (1 + overscan)` */; + const float aspx = w / float(calibration_width_); + const float aspy = h / float(calibration_height_); float xy[2]; float distorted_xy[2]; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc index fec7c1972f3..991a909ddb7 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc @@ -93,7 +93,7 @@ void MultilayerColorOperation::execute_pixel_sampled(float output[4], else { int yi = y; int xi = x; - if (xi < 0 || yi < 0 || (uint)xi >= this->get_width() || (uint)yi >= this->get_height()) { + if (xi < 0 || yi < 0 || uint(xi) >= this->get_width() || uint(yi) >= this->get_height()) { zero_v4(output); } else { @@ -115,7 +115,7 @@ void MultilayerValueOperation::execute_pixel_sampled(float output[4], else { int yi = y; int xi = x; - if (xi < 0 || yi < 0 || (uint)xi >= this->get_width() || (uint)yi >= this->get_height()) { + if (xi < 0 || yi < 0 || uint(xi) >= this->get_width() || uint(yi) >= this->get_height()) { output[0] = 0.0f; } else { @@ -136,7 +136,7 @@ void MultilayerVectorOperation::execute_pixel_sampled(float output[4], else { int yi = y; int xi = x; - if (xi < 0 || yi < 0 || (uint)xi >= this->get_width() || (uint)yi >= this->get_height()) { + if (xi < 0 || yi < 0 || uint(xi) >= this->get_width() || uint(yi) >= this->get_height()) { output[0] = 0.0f; } else { diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc index 9c19f55e04f..18b43f73356 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc @@ -82,7 +82,7 @@ void PlaneDistortWarpImageOperation::calculate_corners(const float corners[4][2] } float frame_corners[4][2] = { - {0.0f, 0.0f}, {(float)width, 0.0f}, {(float)width, (float)height}, {0.0f, (float)height}}; + {0.0f, 0.0f}, {float(width), 0.0f}, {float(width), float(height)}, {0.0f, float(height)}}; BKE_tracking_homography_between_two_quads( sample_data->frame_space_corners, frame_corners, sample_data->perspective_matrix); } @@ -116,7 +116,7 @@ void PlaneDistortWarpImageOperation::execute_pixel_sampled(float output[4], pixel_reader_->read_filtered(color, uv[0], uv[1], deriv[0], deriv[1]); add_v4_v4(output, color); } - mul_v4_fl(output, 1.0f / (float)motion_blur_samples_); + mul_v4_fl(output, 1.0f / float(motion_blur_samples_)); } } @@ -143,7 +143,7 @@ void PlaneDistortWarpImageOperation::update_memory_buffer_partial(MemoryBuffer * input_img->read_elem_filtered(uv[0], uv[1], deriv[0], deriv[1], color); add_v4_v4(it.out, color); } - mul_v4_fl(it.out, 1.0f / (float)motion_blur_samples_); + mul_v4_fl(it.out, 1.0f / float(motion_blur_samples_)); } } } @@ -258,7 +258,7 @@ void PlaneDistortMaskOperation::execute_pixel_sampled(float output[4], inside_counter++; } } - output[0] = (float)inside_counter / osa_; + output[0] = float(inside_counter) / osa_; } else { for (int motion_sample = 0; motion_sample < motion_blur_samples_; motion_sample++) { @@ -278,7 +278,7 @@ void PlaneDistortMaskOperation::execute_pixel_sampled(float output[4], } } } - output[0] = (float)inside_counter / (osa_ * motion_blur_samples_); + output[0] = float(inside_counter) / (osa_ * motion_blur_samples_); } } @@ -292,7 +292,7 @@ void PlaneDistortMaskOperation::update_memory_buffer_partial(MemoryBuffer *outpu MotionSample &sample = samples_[motion_sample]; inside_count += get_jitter_samples_inside_count(it.x, it.y, sample); } - *it.out = (float)inside_count / (osa_ * motion_blur_samples_); + *it.out = float(inside_count) / (osa_ * motion_blur_samples_); } } diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc index 7d515284737..f5922d54fc9 100644 --- a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc @@ -28,7 +28,7 @@ void PlaneTrackCommon::read_and_calculate_corners(PlaneDistortBaseOperation *dis distort_op->calculate_corners(corners, true, 0); } else { - const float frame = (float)framenumber_ - distort_op->motion_blur_shutter_; + const float frame = float(framenumber_) - distort_op->motion_blur_shutter_; const float frame_step = (distort_op->motion_blur_shutter_ * 2.0f) / distort_op->motion_blur_samples_; float frame_iter = frame; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cc b/source/blender/compositor/operations/COM_PreviewOperation.cc index 2a6d858f91c..cf48942c542 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cc +++ b/source/blender/compositor/operations/COM_PreviewOperation.cc @@ -39,7 +39,7 @@ void PreviewOperation::init_execution() { input_ = get_input_socket_reader(0); - if (this->get_width() == (uint)preview_->xsize && this->get_height() == (uint)preview_->ysize) { + if (this->get_width() == uint(preview_->xsize) && this->get_height() == uint(preview_->ysize)) { output_buffer_ = preview_->rect; } @@ -124,10 +124,10 @@ void PreviewOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti divider_ = 0.0f; if (width > 0 && height > 0) { if (width > height) { - divider_ = (float)COM_PREVIEW_SIZE / (width); + divider_ = float(COM_PREVIEW_SIZE) / (width); } else { - divider_ = (float)COM_PREVIEW_SIZE / (height); + divider_ = float(COM_PREVIEW_SIZE) / (height); } } width = width * divider_; diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cc b/source/blender/compositor/operations/COM_RenderLayersProg.cc index fa9efbe15be..e390ab38c7f 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cc +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cc @@ -323,8 +323,8 @@ void RenderLayersDepthProg::execute_pixel_sampled(float output[4], int iy = y; float *input_buffer = this->get_input_buffer(); - if (input_buffer == nullptr || ix < 0 || iy < 0 || ix >= (int)this->get_width() || - iy >= (int)this->get_height()) { + if (input_buffer == nullptr || ix < 0 || iy < 0 || ix >= int(this->get_width()) || + iy >= int(this->get_height())) { output[0] = 10e10f; } else { diff --git a/source/blender/compositor/operations/COM_RotateOperation.cc b/source/blender/compositor/operations/COM_RotateOperation.cc index 79f8cf5fc51..b0854cace52 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cc +++ b/source/blender/compositor/operations/COM_RotateOperation.cc @@ -143,7 +143,7 @@ inline void RotateOperation::ensure_degree() double rad; if (do_degree2_rad_conversion_) { - rad = DEG2RAD((double)degree[0]); + rad = DEG2RAD(double(degree[0])); } else { rad = degree[0]; diff --git a/source/blender/compositor/operations/COM_SMAAOperation.cc b/source/blender/compositor/operations/COM_SMAAOperation.cc index 55983572ede..7bbc600cda2 100644 --- a/source/blender/compositor/operations/COM_SMAAOperation.cc +++ b/source/blender/compositor/operations/COM_SMAAOperation.cc @@ -65,7 +65,7 @@ static void sample_bilinear_vertical(T *reader, int x, int y, float yoffset, flo { float iy = floorf(yoffset); float fy = yoffset - iy; - y += (int)iy; + y += int(iy); float color00[4], color01[4]; @@ -83,7 +83,7 @@ static void sample_bilinear_horizontal(T *reader, int x, int y, float xoffset, f { float ix = floorf(xoffset); float fx = xoffset - ix; - x += (int)ix; + x += int(ix); float color00[4], color10[4]; @@ -113,12 +113,12 @@ static inline const float *areatex_sample_internal(const float *areatex, int x, static void area(int d1, int d2, int e1, int e2, float weights[2]) { /* The areas texture is compressed quadratically: */ - float x = (float)(SMAA_AREATEX_MAX_DISTANCE * e1) + sqrtf((float)d1); - float y = (float)(SMAA_AREATEX_MAX_DISTANCE * e2) + sqrtf((float)d2); + float x = float(SMAA_AREATEX_MAX_DISTANCE * e1) + sqrtf(float(d1)); + float y = float(SMAA_AREATEX_MAX_DISTANCE * e2) + sqrtf(float(d2)); float ix = floorf(x), iy = floorf(y); float fx = x - ix, fy = y - iy; - int X = (int)ix, Y = (int)iy; + int X = int(ix), Y = int(iy); const float *weights00 = areatex_sample_internal(areatex, X + 0, Y + 0); const float *weights10 = areatex_sample_internal(areatex, X + 1, Y + 0); diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cc b/source/blender/compositor/operations/COM_ScaleOperation.cc index 2a2aff31893..cc914239caf 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cc +++ b/source/blender/compositor/operations/COM_ScaleOperation.cc @@ -16,7 +16,7 @@ namespace blender::compositor { BaseScaleOperation::BaseScaleOperation() { #ifdef USE_FORCE_BILINEAR - sampler_ = (int)PixelSampler::Bilinear; + sampler_ = int(PixelSampler::Bilinear); #else sampler_ = -1; #endif @@ -372,8 +372,8 @@ void ScaleFixedSizeOperation::init_data(const rcti &input_canvas) { const int input_width = BLI_rcti_size_x(&input_canvas); const int input_height = BLI_rcti_size_y(&input_canvas); - rel_x_ = input_width / (float)new_width_; - rel_y_ = input_height / (float)new_height_; + rel_x_ = input_width / float(new_width_); + rel_y_ = input_height / float(new_height_); /* *** all the options below are for a fairly special case - camera framing *** */ if (offset_x_ != 0.0f || offset_y_ != 0.0f) { diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc index 0fc5589a3df..e27ffcb7c9b 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc @@ -40,8 +40,8 @@ void ScreenLensDistortionOperation::set_dispersion(float dispersion) void ScreenLensDistortionOperation::init_data() { - cx_ = 0.5f * (float)get_width(); - cy_ = 0.5f * (float)get_height(); + cx_ = 0.5f * float(get_width()); + cy_ = 0.5f * float(get_height()); switch (execution_model_) { case eExecutionModel::FullFrame: { @@ -72,8 +72,8 @@ void ScreenLensDistortionOperation::init_execution() input_program_ = this->get_input_socket_reader(0); this->init_mutex(); - uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX); - rng_seed ^= (uint)POINTER_AS_INT(input_program_); + uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX); + rng_seed ^= uint(POINTER_AS_INT(input_program_)); rng_ = BLI_rng_new(rng_seed); } @@ -147,8 +147,8 @@ void ScreenLensDistortionOperation::accumulate(const MemoryBuffer *buffer, float color[4]; float dsf = len_v2v2(delta[a], delta[b]) + 1.0f; - int ds = jitter_ ? (dsf < 4.0f ? 2 : (int)sqrtf(dsf)) : (int)dsf; - float sd = 1.0f / (float)ds; + int ds = jitter_ ? (dsf < 4.0f ? 2 : int(sqrtf(dsf))) : int(dsf); + float sd = 1.0f / float(ds); float k4 = k4_[a]; float dk4 = dk4_[a]; @@ -178,7 +178,7 @@ void ScreenLensDistortionOperation::accumulate(const MemoryBuffer *buffer, void ScreenLensDistortionOperation::execute_pixel(float output[4], int x, int y, void *data) { MemoryBuffer *buffer = (MemoryBuffer *)data; - float xy[2] = {(float)x, (float)y}; + float xy[2] = {float(x), float(y)}; float uv[2]; get_uv(xy, uv); float uv_dot = len_squared_v2(uv); @@ -196,13 +196,13 @@ void ScreenLensDistortionOperation::execute_pixel(float output[4], int x, int y, accumulate(buffer, 1, 2, uv_dot, uv, delta, sum, count); if (count[0]) { - output[0] = 2.0f * sum[0] / (float)count[0]; + output[0] = 2.0f * sum[0] / float(count[0]); } if (count[1]) { - output[1] = 2.0f * sum[1] / (float)count[1]; + output[1] = 2.0f * sum[1] / float(count[1]); } if (count[2]) { - output[2] = 2.0f * sum[2] / (float)count[2]; + output[2] = 2.0f * sum[2] / float(count[2]); } /* set alpha */ @@ -485,7 +485,7 @@ void ScreenLensDistortionOperation::update_memory_buffer_partial(MemoryBuffer *o { const MemoryBuffer *input_image = inputs[0]; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { - float xy[2] = {(float)it.x, (float)it.y}; + float xy[2] = {float(it.x), float(it.y)}; float uv[2]; get_uv(xy, uv); const float uv_dot = len_squared_v2(uv); @@ -505,13 +505,13 @@ void ScreenLensDistortionOperation::update_memory_buffer_partial(MemoryBuffer *o accumulate(input_image, 1, 2, uv_dot, uv, delta, sum, count); if (count[0]) { - it.out[0] = 2.0f * sum[0] / (float)count[0]; + it.out[0] = 2.0f * sum[0] / float(count[0]); } if (count[1]) { - it.out[1] = 2.0f * sum[1] / (float)count[1]; + it.out[1] = 2.0f * sum[1] / float(count[1]); } if (count[2]) { - it.out[2] = 2.0f * sum[2] / (float)count[2]; + it.out[2] = 2.0f * sum[2] / float(count[2]); } /* Set alpha. */ diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cc b/source/blender/compositor/operations/COM_SunBeamsOperation.cc index 1628c0fa1f8..94674c8fd6c 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cc +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cc @@ -52,18 +52,18 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { static inline void buffer_to_sector(const float source[2], float x, float y, float &u, float &v) { - int x0 = (int)source[0]; - int y0 = (int)source[1]; - x -= (float)x0; - y -= (float)y0; + int x0 = int(source[0]); + int y0 = int(source[1]); + x -= float(x0); + y -= float(y0); u = x * fxu + y * fyu; v = x * fxv + y * fyv; } static inline void sector_to_buffer(const float source[2], int u, int v, int &x, int &y) { - int x0 = (int)source[0]; - int y0 = (int)source[1]; + int x0 = int(source[0]); + int y0 = int(source[1]); x = x0 + u * fxu + v * fxv; y = y0 + u * fyu + v * fyv; } @@ -95,7 +95,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { buffer_to_sector(source, co[0], co[1], pu, pv); /* line angle */ - double tan_phi = pv / (double)pu; + double tan_phi = pv / double(pu); double dr = sqrt(tan_phi * tan_phi + 1.0); double cos_phi = 1.0 / dr; @@ -105,13 +105,13 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { v = umin * tan_phi; dv = tan_phi; - int start = (int)floorf(umax); - int end = (int)ceilf(umin); + int start = int(floorf(umax)); + int end = int(ceilf(umin)); num = end - start; - sector_to_buffer(source, end, (int)ceilf(v), x, y); + sector_to_buffer(source, end, int(ceilf(v)), x, y); - falloff_factor = dist_max > dist_min ? dr / (double)(dist_max - dist_min) : 0.0f; + falloff_factor = dist_max > dist_min ? dr / double(dist_max - dist_min) : 0.0f; float *iter = input->get_buffer() + input->get_coords_offset(x, y); return iter; @@ -139,7 +139,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { zero_v4(output); - if ((int)(co[0] - source[0]) == 0 && (int)(co[1] - source[1]) == 0) { + if (int(co[0] - source[0]) == 0 && int(co[1] - source[1]) == 0) { copy_v4_v4(output, input->get_elem(source[0], source[1])); return; } @@ -154,7 +154,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { float v_local = v - floorf(v); for (int i = 0; i < num; i++) { - float weight = 1.0f - (float)i * falloff_factor; + float weight = 1.0f - float(i) * falloff_factor; weight *= weight; /* range check, use last valid color when running beyond the image border */ @@ -195,7 +195,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { /* normalize */ if (num > 0) { - mul_v4_fl(output, 1.0f / (float)num); + mul_v4_fl(output, 1.0f / float(num)); } } }; @@ -288,14 +288,14 @@ void *SunBeamsOperation::initialize_tile_data(rcti * /*rect*/) void SunBeamsOperation::execute_pixel(float output[4], int x, int y, void *data) { - const float co[2] = {(float)x, (float)y}; + const float co[2] = {float(x), float(y)}; accumulate_line((MemoryBuffer *)data, output, co, source_px_, 0.0f, ray_length_px_); } static void calc_ray_shift(rcti *rect, float x, float y, const float source[2], float ray_length) { - float co[2] = {(float)x, (float)y}; + float co[2] = {float(x), float(y)}; float dir[2], dist; /* move (x,y) vector toward the source by ray_length distance */ @@ -304,7 +304,7 @@ static void calc_ray_shift(rcti *rect, float x, float y, const float source[2], mul_v2_fl(dir, min_ff(dist, ray_length)); sub_v2_v2(co, dir); - int ico[2] = {(int)co[0], (int)co[1]}; + int ico[2] = {int(co[0]), int(co[1])}; BLI_rcti_do_minmax_v(rect, ico); } diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cc b/source/blender/compositor/operations/COM_TonemapOperation.cc index 714625e483d..ae5b60c4912 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cc +++ b/source/blender/compositor/operations/COM_TonemapOperation.cc @@ -120,11 +120,11 @@ void *TonemapOperation::initialize_tile_data(rcti *rect) } data->lav = Lav * sc; mul_v3_v3fl(data->cav, cav, sc); - maxl = log((double)maxl + 1e-5); - minl = log((double)minl + 1e-5); + maxl = log(double(maxl) + 1e-5); + minl = log(double(minl) + 1e-5); avl = lsum * sc; data->auto_key = (maxl > minl) ? ((maxl - avl) / (maxl - minl)) : 1.0f; - float al = exp((double)avl); + float al = exp(double(avl)); data->al = (al == 0.0f) ? 0.0f : (data_->key / al); data->igm = (data_->gamma == 0.0f) ? 1 : (1.0f / data_->gamma); cached_instance_ = data; @@ -193,11 +193,11 @@ void TonemapOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(output) AvgLogLum *avg = new AvgLogLum(); avg->lav = lum.sum / lum.num_pixels; mul_v3_v3fl(avg->cav, lum.color_sum, 1.0f / lum.num_pixels); - const float max_log = log((double)lum.max + 1e-5); - const float min_log = log((double)lum.min + 1e-5); + const float max_log = log(double(lum.max) + 1e-5); + const float min_log = log(double(lum.min) + 1e-5); const float avg_log = lum.log_sum / lum.num_pixels; avg->auto_key = (max_log > min_log) ? ((max_log - avg_log) / (max_log - min_log)) : 1.0f; - const float al = exp((double)avg_log); + const float al = exp(double(avg_log)); avg->al = (al == 0.0f) ? 0.0f : (data_->key / al); avg->igm = (data_->gamma == 0.0f) ? 1 : (1.0f / data_->gamma); cached_instance_ = avg; diff --git a/source/blender/compositor/operations/COM_TransformOperation.cc b/source/blender/compositor/operations/COM_TransformOperation.cc index 36a4899ef53..0db018a3dc0 100644 --- a/source/blender/compositor/operations/COM_TransformOperation.cc +++ b/source/blender/compositor/operations/COM_TransformOperation.cc @@ -38,7 +38,7 @@ void TransformOperation::init_data() translate_factor_y_; const float degree = get_input_operation(DEGREE_INPUT_INDEX)->get_constant_value_default(0.0f); - const double rad = convert_degree_to_rad_ ? DEG2RAD((double)degree) : degree; + const double rad = convert_degree_to_rad_ ? DEG2RAD(double(degree)) : degree; rotate_cosine_ = cos(rad); rotate_sine_ = sin(rad); diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc index 9a02bd70586..bf6ee64c73f 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc @@ -61,7 +61,7 @@ void *VariableSizeBokehBlurOperation::initialize_tile_data(rcti *rect) const float max_dim = MAX2(this->get_width(), this->get_height()); const float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f; - data->max_blur_scalar = (int)(data->size->get_max_value(rect2) * scalar); + data->max_blur_scalar = int(data->size->get_max_value(rect2) * scalar); CLAMP(data->max_blur_scalar, 1.0f, max_blur_); return data; } @@ -106,8 +106,8 @@ void VariableSizeBokehBlurOperation::execute_pixel(float output[4], int x, int y #else int minx = MAX2(x - max_blur_scalar, 0); int miny = MAX2(y - max_blur_scalar, 0); - int maxx = MIN2(x + max_blur_scalar, (int)get_width()); - int maxy = MIN2(y + max_blur_scalar, (int)get_height()); + int maxx = MIN2(x + max_blur_scalar, int(get_width())); + int maxy = MIN2(y + max_blur_scalar, int(get_height())); #endif { input_size_buffer->read_no_check(temp_size, x, y); @@ -134,10 +134,10 @@ void VariableSizeBokehBlurOperation::execute_pixel(float output[4], int x, int y float dx = nx - x; if (size > fabsf(dx) && size > fabsf(dy)) { float uv[2] = { - (float)(COM_BLUR_BOKEH_PIXELS / 2) + - (dx / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1), - (float)(COM_BLUR_BOKEH_PIXELS / 2) + - (dy / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1), + float(COM_BLUR_BOKEH_PIXELS / 2) + + (dx / size) * float((COM_BLUR_BOKEH_PIXELS / 2) - 1), + float(COM_BLUR_BOKEH_PIXELS / 2) + + (dy / size) * float((COM_BLUR_BOKEH_PIXELS / 2) - 1), }; input_bokeh_buffer->read(bokeh, uv[0], uv[1]); madd_v4_v4v4(color_accum, bokeh, &input_program_float_buffer[offset_color_nx_ny]); @@ -185,7 +185,7 @@ void VariableSizeBokehBlurOperation::execute_opencl( const float max_dim = MAX2(get_width(), get_height()); cl_float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f; - max_blur = (cl_int)min_ff(size_memory_buffer->get_max_value() * scalar, (float)max_blur_); + max_blur = (cl_int)min_ff(size_memory_buffer->get_max_value() * scalar, float(max_blur_)); device->COM_cl_attach_memory_buffer_to_kernel_parameter( defocus_kernel, 0, -1, cl_mem_to_clean_up, input_memory_buffers, input_program_); @@ -358,10 +358,10 @@ static void blur_pixel(int x, int y, PixelData &p) /* XXX: There is no way to ensure bokeh input is an actual bokeh with #COM_BLUR_BOKEH_PIXELS * size, anything may be connected. Use the real input size and remove asserts? */ - const float u = (float)(COM_BLUR_BOKEH_PIXELS / 2) + - (dx / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1); - const float v = (float)(COM_BLUR_BOKEH_PIXELS / 2) + - (dy / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1); + const float u = float(COM_BLUR_BOKEH_PIXELS / 2) + + (dx / size) * float((COM_BLUR_BOKEH_PIXELS / 2) - 1); + const float v = float(COM_BLUR_BOKEH_PIXELS / 2) + + (dy / size) * float((COM_BLUR_BOKEH_PIXELS / 2) - 1); float bokeh[4]; p.bokeh_input->read_elem_checked(u, v, bokeh); madd_v4_v4v4(p.color_accum, bokeh, color); diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc index 75d6bba713d..c71d88695a7 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc @@ -388,9 +388,9 @@ static void zbuf_fill_in_rgba( xx1 = (x0 * v1[0] + y0 * v1[1]) / z0 + v1[2]; - zxd = -(double)x0 / (double)z0; - zyd = -(double)y0 / (double)z0; - zy0 = ((double)my2) * zyd + (double)xx1; + zxd = -double(x0) / double(z0); + zyd = -double(y0) / double(z0); + zy0 = double(my2) * zyd + double(xx1); /* start-offset in rect */ rectx = zspan->rectx; @@ -422,13 +422,13 @@ static void zbuf_fill_in_rgba( } if (sn2 >= sn1) { - zverg = (double)sn1 * zxd + zy0; + zverg = double(sn1) * zxd + zy0; rz = rectzofs + sn1; rp = rectpofs + sn1; x = sn2 - sn1; while (x >= 0) { - if (zverg < (double)*rz) { + if (zverg < double(*rz)) { *rz = zverg; *rp = *col; } @@ -593,15 +593,15 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, const float *dimg, *dz, *ro; float *rectvz, *dvz, *dvec1, *dvec2, *dz1, *dz2, *rectz; float *minvecbufrect = nullptr, *rectweight, *rw, *rectmax, *rm; - float maxspeedsq = (float)nbd->maxspeed * nbd->maxspeed; + float maxspeedsq = float(nbd->maxspeed) * nbd->maxspeed; int y, x, step, maxspeed = nbd->maxspeed, samples = nbd->samples; int tsktsk = 0; static int firsttime = 1; char *rectmove, *dm; zbuf_alloc_span(&zspan, xsize, ysize, 1.0f); - zspan.zmulx = ((float)xsize) / 2.0f; - zspan.zmuly = ((float)ysize) / 2.0f; + zspan.zmulx = float(xsize) / 2.0f; + zspan.zmuly = float(ysize) / 2.0f; zspan.zofsx = 0.0f; zspan.zofsy = 0.0f; @@ -630,7 +630,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, /* Min speed? then copy speed-buffer to recalculate speed vectors. */ if (nbd->minspeed) { - float minspeed = (float)nbd->minspeed; + float minspeed = float(nbd->minspeed); float minspeedsq = minspeed * minspeed; minvecbufrect = (float *)MEM_callocN(sizeof(float[4]) * xsize * ysize, "minspeed buf"); @@ -729,7 +729,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, if (maxspeed) { float speedsq = dvz[0] * dvz[0] + dvz[1] * dvz[1]; if (speedsq > maxspeedsq) { - speedsq = (float)maxspeed / sqrtf(speedsq); + speedsq = float(maxspeed) / sqrtf(speedsq); dvz[0] *= speedsq; dvz[1] *= speedsq; } @@ -779,7 +779,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, /* accumulate */ samples /= 2; for (step = 1; step <= samples; step++) { - float speedfac = 0.5f * nbd->fac * (float)step / (float)(samples + 1); + float speedfac = 0.5f * nbd->fac * float(step) / float(samples + 1); int side; for (side = 0; side < 2; side++) { @@ -867,7 +867,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, col.alpha = 0.0f; } else { - col.alpha = ((float)*dm) / 255.0f; + col.alpha = float(*dm) / 255.0f; } col.colpoin = dimg; @@ -885,7 +885,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, * we don't know what is behind it so we don't do that. this hack * overestimates the contribution of foreground pixels but looks a * bit better without a sudden cutoff. */ - blendfac = ((samples - step) / (float)samples); + blendfac = ((samples - step) / float(samples)); /* Smooth-step to make it look a bit nicer as well. */ blendfac = 3.0f * pow(blendfac, 2.0f) - 2.0f * pow(blendfac, 3.0f); diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index c1874bb51db..1d0aead3a94 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -264,7 +264,7 @@ void ViewerOperation::clear_display_buffer() return; } - size_t buf_bytes = (size_t)ibuf_->y * ibuf_->x * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float); + size_t buf_bytes = size_t(ibuf_->y) * ibuf_->x * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float); if (buf_bytes > 0) { memset(output_buffer_, 0, buf_bytes); rcti display_area; |