diff options
Diffstat (limited to 'lib/jxl/enc_noise.cc')
-rw-r--r-- | lib/jxl/enc_noise.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/jxl/enc_noise.cc b/lib/jxl/enc_noise.cc index 383b792..3628761 100644 --- a/lib/jxl/enc_noise.cc +++ b/lib/jxl/enc_noise.cc @@ -14,7 +14,6 @@ #include <utility> #include "lib/jxl/base/compiler_specific.h" -#include "lib/jxl/base/robust_statistics.h" #include "lib/jxl/chroma_from_luma.h" #include "lib/jxl/convolve.h" #include "lib/jxl/image_ops.h" @@ -75,16 +74,12 @@ class NoiseHistogram { int Get(const float x) const { return bins[Index(x)]; } int Bin(const size_t bin) const { return bins[bin]; } - void Print() const { - for (unsigned int bin : bins) { - printf("%d\n", bin); - } - } - int Mode() const { - uint32_t cdf[kBins]; - std::partial_sum(bins, bins + kBins, cdf); - return HalfRangeMode()(cdf, kBins); + size_t max_idx = 0; + for (size_t i = 0; i < kBins; i++) { + if (bins[i] > bins[max_idx]) max_idx = i; + } + return max_idx; } double Quantile(double q01) const { |