summaryrefslogtreecommitdiff
path: root/samples/image_diff.cc
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-26 10:55:54 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-26 20:07:23 +0000
commite47e0c96009b8633294eebbb9eb0e84caf525c57 (patch)
tree093c0edb121e54c22e40a704ce473eb48491ccfc /samples/image_diff.cc
parent2e2a4fcd43677c5882dcf00cb4b99635cb2cfcd3 (diff)
downloadpdfium-e47e0c96009b8633294eebbb9eb0e84caf525c57.tar.xz
Avoid unordered_set and maps for the time being.chromium/3082
See discussion at https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/rdxOHKzQmRY Change-Id: I1803ae97c39b592001835814e2f6674b2c7cb3ea Reviewed-on: https://pdfium-review.googlesource.com/4531 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'samples/image_diff.cc')
-rw-r--r--samples/image_diff.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/samples/image_diff.cc b/samples/image_diff.cc
index 3aa626be65..70c74c951c 100644
--- a/samples/image_diff.cc
+++ b/samples/image_diff.cc
@@ -166,9 +166,6 @@ float PercentageDifferent(const Image& baseline, const Image& actual) {
return CalculateDifferencePercentage(actual, pixels_different);
}
-// FIXME: Replace with unordered_map when available.
-typedef std::map<uint32_t, int32_t> RgbaToCountMap;
-
float HistogramPercentageDifferent(const Image& baseline, const Image& actual) {
// TODO(johnme): Consider using a joint histogram instead, as described in
// "Comparing Images Using Joint Histograms" by Pass & Zabih
@@ -178,7 +175,7 @@ float HistogramPercentageDifferent(const Image& baseline, const Image& actual) {
int h = std::min(baseline.h(), actual.h());
// Count occurences of each RGBA pixel value of baseline in the overlap.
- RgbaToCountMap baseline_histogram;
+ std::map<uint32_t, int32_t> baseline_histogram;
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
// hash_map operator[] inserts a 0 (default constructor) if key not found.
@@ -191,7 +188,7 @@ float HistogramPercentageDifferent(const Image& baseline, const Image& actual) {
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
uint32_t actual_rgba = actual.pixel_at(x, y);
- RgbaToCountMap::iterator it = baseline_histogram.find(actual_rgba);
+ auto it = baseline_histogram.find(actual_rgba);
if (it != baseline_histogram.end() && it->second > 0)
--it->second;
else