summaryrefslogtreecommitdiff
path: root/core/io/image.cpp
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-09-29 12:53:28 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-10-07 11:32:33 +0300
commit0103af1ddda6a2aa31227965141dd7d3a513e081 (patch)
treeb0965bb65919bc1495ee02204a91e5ed3a9b56a7 /core/io/image.cpp
parent5b7f62af55b7f322192f95258d825b163cbf9dc1 (diff)
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4.
Diffstat (limited to 'core/io/image.cpp')
-rw-r--r--core/io/image.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/io/image.cpp b/core/io/image.cpp
index 56c05bf042..4be624a5a8 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -3869,15 +3869,15 @@ Dictionary Image::compute_image_metrics(const Ref<Image> p_compared_image, bool
double image_metric_max, image_metric_mean, image_metric_mean_squared, image_metric_root_mean_squared, image_metric_peak_snr = 0.0;
const bool average_component_error = true;
- const uint32_t width = MIN(compared_image->get_width(), source_image->get_width());
- const uint32_t height = MIN(compared_image->get_height(), source_image->get_height());
+ const uint32_t w = MIN(compared_image->get_width(), source_image->get_width());
+ const uint32_t h = MIN(compared_image->get_height(), source_image->get_height());
// Histogram approach originally due to Charles Bloom.
double hist[256];
memset(hist, 0, sizeof(hist));
- for (uint32_t y = 0; y < height; y++) {
- for (uint32_t x = 0; x < width; x++) {
+ for (uint32_t y = 0; y < h; y++) {
+ for (uint32_t x = 0; x < w; x++) {
const Color color_a = compared_image->get_pixel(x, y);
const Color color_b = source_image->get_pixel(x, y);
@@ -3922,7 +3922,7 @@ Dictionary Image::compute_image_metrics(const Ref<Image> p_compared_image, bool
}
// See http://richg42.blogspot.com/2016/09/how-to-compute-psnr-from-old-berkeley.html
- double total_values = width * height;
+ double total_values = w * h;
if (average_component_error) {
total_values *= 4;