diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/jpeg-xl/lib/jxl/enc_noise.cc | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/enc_noise.cc')
-rw-r--r-- | third_party/jpeg-xl/lib/jxl/enc_noise.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/enc_noise.cc b/third_party/jpeg-xl/lib/jxl/enc_noise.cc index a12a9e6dc4..80b90eed2c 100644 --- a/third_party/jpeg-xl/lib/jxl/enc_noise.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_noise.cc @@ -114,7 +114,7 @@ class NoiseHistogram { private: template <typename T> T ClampX(const T x) const { - return std::min(std::max(T(0), x), T(kBins - 1)); + return std::min(std::max(static_cast<T>(0), x), static_cast<T>(kBins - 1)); } size_t Index(const float x) const { return ClampX(static_cast<int>(x)); } @@ -321,7 +321,7 @@ std::vector<NoiseLevel> GetNoiseLevel( void EncodeFloatParam(float val, float precision, BitWriter* writer) { JXL_ASSERT(val >= 0); - const int absval_quant = static_cast<int>(val * precision + 0.5f); + const int absval_quant = static_cast<int>(std::lround(val * precision)); JXL_ASSERT(absval_quant < (1 << 10)); writer->Write(10, absval_quant); } |