Core: Replace C math headers with C++ equivalents

- Minor restructuring to ensure `math_funcs.h` is the central point for math functions
This commit is contained in:
Thaddeus Crews
2025-03-19 14:18:09 -05:00
parent c5c1cd4440
commit ad40939b6f
101 changed files with 414 additions and 498 deletions

View File

@@ -38,8 +38,6 @@
#include "core/templates/hash_map.h"
#include "core/variant/dictionary.h"
#include <cmath>
const char *Image::format_names[Image::FORMAT_MAX] = {
"Lum8",
"LumAlpha8",
@@ -4418,12 +4416,12 @@ Dictionary Image::compute_image_metrics(const Ref<Image> p_compared_image, bool
image_metric_mean = CLAMP(sum / total_values, 0.0f, 255.0f);
image_metric_mean_squared = CLAMP(sum2 / total_values, 0.0f, 255.0f * 255.0f);
image_metric_root_mean_squared = sqrt(image_metric_mean_squared);
image_metric_root_mean_squared = std::sqrt(image_metric_mean_squared);
if (!image_metric_root_mean_squared) {
image_metric_peak_snr = 1e+10f;
} else {
image_metric_peak_snr = CLAMP(log10(255.0f / image_metric_root_mean_squared) * 20.0f, 0.0f, 500.0f);
image_metric_peak_snr = CLAMP(std::log10(255.0f / image_metric_root_mean_squared) * 20.0f, 0.0f, 500.0f);
}
result["max"] = image_metric_max;
result["mean"] = image_metric_mean;