diff options
| author | Jonathan Hamilton <jtrhamilton@gmail.com> | 2018-05-16 17:50:39 -0700 |
|---|---|---|
| committer | Jonathan Hamilton <jtrhamilton@gmail.com> | 2018-05-16 17:51:50 -0700 |
| commit | 61a81795e5afe551f5622f146ca52d5331069742 (patch) | |
| tree | 2085cc41a80e12a57b2a9083dbe13949c7ad30cf /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | 8be5cdfcad046f084441e71ee8204dfb40a18d2d (diff) | |
Change the arbitrary mipmap detection to use the square of the error
Hopefully this better matches the user's view of a texture - as large changes in
colour should be weighted higher than lots of very small changes
Note: This likely invalidates the current heuristic threshold default
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 370bdd836b..1b385dcbfe 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -608,10 +608,13 @@ private: const auto* row2 = ptr2; for (u32 j = 0; j < shape.width; ++j, row1 += 4, row2 += 4) { - average_diff += std::abs(static_cast<float>(row1[0]) - static_cast<float>(row2[0])); - average_diff += std::abs(static_cast<float>(row1[1]) - static_cast<float>(row2[1])); - average_diff += std::abs(static_cast<float>(row1[2]) - static_cast<float>(row2[2])); - average_diff += std::abs(static_cast<float>(row1[3]) - static_cast<float>(row2[3])); + for (int channel = 0; channel < 4; channel++) + { + const float diff = + std::abs(static_cast<float>(row1[channel]) - static_cast<float>(row2[channel])); + const float diff_squared = diff * diff; + average_diff += diff_squared; + } } ptr1 += shape.row_length; ptr2 += shape.row_length; |
