mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user