Commit aaf7343e authored by epoger@google.com's avatar epoger@google.com
Browse files

Remove third-party cityhash, unused since r8992

R=djsollen@google.com

Review URL: https://codereview.chromium.org/15027013

git-svn-id: http://skia.googlecode.com/svn/trunk@9059 2bbb7eff-a529-9590-31e7-b0007b416f81
parent 0a01f5a2
...@@ -9,7 +9,6 @@ use_relative_paths = True ...@@ -9,7 +9,6 @@ use_relative_paths = True
# #
deps = { deps = {
"third_party/externals/angle" : "http://angleproject.googlecode.com/svn/trunk@1268", "third_party/externals/angle" : "http://angleproject.googlecode.com/svn/trunk@1268",
"third_party/externals/cityhash" : "http://cityhash.googlecode.com/svn/trunk@11",
"third_party/externals/freetype" : "https://android.googlesource.com/platform/external/freetype.git", "third_party/externals/freetype" : "https://android.googlesource.com/platform/external/freetype.git",
"third_party/externals/gyp" : "http://gyp.googlecode.com/svn/trunk@1563", "third_party/externals/gyp" : "http://gyp.googlecode.com/svn/trunk@1563",
"third_party/externals/libjpeg" : "http://src.chromium.org/svn/trunk/src/third_party/libjpeg@125399", "third_party/externals/libjpeg" : "http://src.chromium.org/svn/trunk/src/third_party/libjpeg@125399",
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "SkBenchmark.h" #include "SkBenchmark.h"
#include "SkCanvas.h" #include "SkCanvas.h"
#include "SkChecksum.h" #include "SkChecksum.h"
#include "SkCityHash.h"
#include "SkMD5.h" #include "SkMD5.h"
#include "SkRandom.h" #include "SkRandom.h"
#include "SkSHA1.h" #include "SkSHA1.h"
...@@ -16,9 +15,7 @@ ...@@ -16,9 +15,7 @@
enum ChecksumType { enum ChecksumType {
kChecksum_ChecksumType, kChecksum_ChecksumType,
kMD5_ChecksumType, kMD5_ChecksumType,
kSHA1_ChecksumType, kSHA1_ChecksumType
kCityHash32,
kCityHash64
}; };
class ComputeChecksumBench : public SkBenchmark { class ComputeChecksumBench : public SkBenchmark {
...@@ -45,8 +42,6 @@ protected: ...@@ -45,8 +42,6 @@ protected:
case kChecksum_ChecksumType: return "compute_checksum"; case kChecksum_ChecksumType: return "compute_checksum";
case kMD5_ChecksumType: return "compute_md5"; case kMD5_ChecksumType: return "compute_md5";
case kSHA1_ChecksumType: return "compute_sha1"; case kSHA1_ChecksumType: return "compute_sha1";
case kCityHash32: return "compute_cityhash32";
case kCityHash64: return "compute_cityhash64";
default: SK_CRASH(); return ""; default: SK_CRASH(); return "";
} }
} }
...@@ -75,18 +70,6 @@ protected: ...@@ -75,18 +70,6 @@ protected:
sha1.finish(digest); sha1.finish(digest);
} }
} break; } break;
case kCityHash32: {
for (int i = 0; i < N; i++) {
volatile uint32_t result = SkCityHash::Compute32(reinterpret_cast<char*>(fData), sizeof(fData));
sk_ignore_unused_variable(result);
}
} break;
case kCityHash64: {
for (int i = 0; i < N; i++) {
volatile uint64_t result = SkCityHash::Compute64(reinterpret_cast<char*>(fData), sizeof(fData));
sk_ignore_unused_variable(result);
}
} break;
} }
} }
...@@ -100,11 +83,7 @@ private: ...@@ -100,11 +83,7 @@ private:
static SkBenchmark* Fact0(void* p) { return new ComputeChecksumBench(p, kChecksum_ChecksumType); } static SkBenchmark* Fact0(void* p) { return new ComputeChecksumBench(p, kChecksum_ChecksumType); }
static SkBenchmark* Fact1(void* p) { return new ComputeChecksumBench(p, kMD5_ChecksumType); } static SkBenchmark* Fact1(void* p) { return new ComputeChecksumBench(p, kMD5_ChecksumType); }
static SkBenchmark* Fact2(void* p) { return new ComputeChecksumBench(p, kSHA1_ChecksumType); } static SkBenchmark* Fact2(void* p) { return new ComputeChecksumBench(p, kSHA1_ChecksumType); }
static SkBenchmark* Fact3(void* p) { return new ComputeChecksumBench(p, kCityHash32); }
static SkBenchmark* Fact4(void* p) { return new ComputeChecksumBench(p, kCityHash64); }
static BenchRegistry gReg0(Fact0); static BenchRegistry gReg0(Fact0);
static BenchRegistry gReg1(Fact1); static BenchRegistry gReg1(Fact1);
static BenchRegistry gReg2(Fact2); static BenchRegistry gReg2(Fact2);
static BenchRegistry gReg3(Fact3);
static BenchRegistry gReg4(Fact4);
...@@ -16,18 +16,10 @@ const static char kJsonKey_ActualResults_Failed[] = "failed"; ...@@ -16,18 +16,10 @@ const static char kJsonKey_ActualResults_Failed[] = "failed";
const static char kJsonKey_ActualResults_FailureIgnored[]= "failure-ignored"; const static char kJsonKey_ActualResults_FailureIgnored[]= "failure-ignored";
const static char kJsonKey_ActualResults_NoComparison[] = "no-comparison"; const static char kJsonKey_ActualResults_NoComparison[] = "no-comparison";
const static char kJsonKey_ActualResults_Succeeded[] = "succeeded"; const static char kJsonKey_ActualResults_Succeeded[] = "succeeded";
#ifdef BITMAPHASHER_USES_TRUNCATED_MD5
const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[] = "bitmap-64bitMD5"; const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[] = "bitmap-64bitMD5";
#else
const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[] = "bitmap-cityhash";
#endif
const static char kJsonKey_ExpectedResults[] = "expected-results"; const static char kJsonKey_ExpectedResults[] = "expected-results";
#ifdef BITMAPHASHER_USES_TRUNCATED_MD5
const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitmap-64bitMD5s"; const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitmap-64bitMD5s";
#else
const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitmap-cityhashes";
#endif
const static char kJsonKey_ExpectedResults_IgnoreFailure[] = "ignore-failure"; const static char kJsonKey_ExpectedResults_IgnoreFailure[] = "ignore-failure";
namespace skiagm { namespace skiagm {
......
{
'variables': {
'skia_warnings_as_errors': 0,
},
'targets': [
{
'target_name': 'cityhash',
'type': 'static_library',
'standalone_static_library': 1,
'include_dirs': [
'../include/config',
'../include/core',
'../src/utils/cityhash',
'../third_party/externals/cityhash/src',
],
'sources': [
'../third_party/externals/cityhash/src/city.cc',
],
'direct_dependent_settings': {
'include_dirs': [
'../third_party/externals/cityhash/src',
],
},
'conditions': [
[ 'skia_os == "android"', {
'cflags!': [
'-Wall',
],
}],
],
},
],
}
...@@ -5,9 +5,6 @@ ...@@ -5,9 +5,6 @@
'product_name': 'skia_utils', 'product_name': 'skia_utils',
'type': 'static_library', 'type': 'static_library',
'standalone_static_library': 1, 'standalone_static_library': 1,
'dependencies': [
'cityhash.gyp:cityhash',
],
'include_dirs': [ 'include_dirs': [
'../include/config', '../include/config',
'../include/core', '../include/core',
...@@ -64,8 +61,6 @@ ...@@ -64,8 +61,6 @@
'../src/utils/SkBitSet.h', '../src/utils/SkBitSet.h',
'../src/utils/SkBoundaryPatch.cpp', '../src/utils/SkBoundaryPatch.cpp',
'../src/utils/SkCamera.cpp', '../src/utils/SkCamera.cpp',
'../src/utils/SkCityHash.cpp',
'../src/utils/SkCityHash.h',
'../src/utils/SkCubicInterval.cpp', '../src/utils/SkCubicInterval.cpp',
'../src/utils/SkCullPoints.cpp', '../src/utils/SkCullPoints.cpp',
'../src/utils/SkDeferredCanvas.cpp', '../src/utils/SkDeferredCanvas.cpp',
...@@ -195,15 +190,6 @@ ...@@ -195,15 +190,6 @@
], ],
'sources!': [ 'sources!': [
'../src/utils/SkThreadUtils_pthread_linux.cpp', '../src/utils/SkThreadUtils_pthread_linux.cpp',
'../src/utils/SkCityHash.cpp',
'../src/utils/SkCityHash.h',
],
'dependencies!': [
# CityHash is not supported on NaCl because the NaCl toolchain is
# missing byteswap.h which is needed by CityHash.
# TODO(borenet): Find a way to either provide this dependency or
# replace it.
'cityhash.gyp:cityhash',
], ],
}], }],
[ 'skia_os == "android"', { [ 'skia_os == "android"', {
......
...@@ -10,12 +10,7 @@ ...@@ -10,12 +10,7 @@
#include "SkEndian.h" #include "SkEndian.h"
#include "SkImageEncoder.h" #include "SkImageEncoder.h"
#ifdef BITMAPHASHER_USES_TRUNCATED_MD5
#include "SkMD5.h" #include "SkMD5.h"
#else
#include "SkCityHash.h"
#include "SkStream.h"
#endif
/** /**
* Write an int32 value to a stream in little-endian order. * Write an int32 value to a stream in little-endian order.
...@@ -37,16 +32,7 @@ static inline uint64_t first_8_bytes_as_uint64(const uint8_t *bytearray) { ...@@ -37,16 +32,7 @@ static inline uint64_t first_8_bytes_as_uint64(const uint8_t *bytearray) {
/*static*/ bool SkBitmapHasher::ComputeDigestInternal(const SkBitmap& bitmap, /*static*/ bool SkBitmapHasher::ComputeDigestInternal(const SkBitmap& bitmap,
SkHashDigest *result) { SkHashDigest *result) {
#ifdef BITMAPHASHER_USES_TRUNCATED_MD5
SkMD5 out; SkMD5 out;
#else
size_t pixelBufferSize = bitmap.width() * bitmap.height() * 4;
size_t totalBufferSize = pixelBufferSize + 2 * sizeof(uint32_t);
SkAutoMalloc bufferManager(totalBufferSize);
char *bufferStart = static_cast<char *>(bufferManager.get());
SkMemoryWStream out(bufferStart, totalBufferSize);
#endif
// start with the x/y dimensions // start with the x/y dimensions
write_int32_to_buffer(SkToU32(bitmap.width()), &out); write_int32_to_buffer(SkToU32(bitmap.width()), &out);
...@@ -58,13 +44,9 @@ static inline uint64_t first_8_bytes_as_uint64(const uint8_t *bytearray) { ...@@ -58,13 +44,9 @@ static inline uint64_t first_8_bytes_as_uint64(const uint8_t *bytearray) {
return false; return false;
} }
#ifdef BITMAPHASHER_USES_TRUNCATED_MD5
SkMD5::Digest digest; SkMD5::Digest digest;
out.finish(digest); out.finish(digest);
*result = first_8_bytes_as_uint64(digest.data); *result = first_8_bytes_as_uint64(digest.data);
#else
*result = SkCityHash::Compute64(bufferStart, totalBufferSize);
#endif
return true; return true;
} }
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#include "SkBitmap.h" #include "SkBitmap.h"
#define BITMAPHASHER_USES_TRUNCATED_MD5
// TODO(epoger): Soon, SkHashDigest will become a real class of its own, // TODO(epoger): Soon, SkHashDigest will become a real class of its own,
// and callers won't be able to assume it converts to/from a uint64_t. // and callers won't be able to assume it converts to/from a uint64_t.
typedef uint64_t SkHashDigest; typedef uint64_t SkHashDigest;
......
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* Pass any calls through to the CityHash library.
* This is the only source file that accesses the CityHash code directly.
*/
#include "SkCityHash.h"
#include "SkTypes.h"
#include "city.h"
uint32_t SkCityHash::Compute32(const char *data, size_t size) {
return CityHash32(data, size);
}
uint64_t SkCityHash::Compute64(const char *data, size_t size) {
return CityHash64(data, size);
}
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* Hash functions, using the CityHash algorithm.
*
* Results are guaranteed to be:
* 1. consistent across revisions of the library (for a given set
* of bytes, the checksum generated at one revision of the Skia
* library will match the one generated on any other revision of
* the Skia library)
* 2. consistent across platforms (for a given
* set of bytes, the checksum generated on one platform will
* match the one generated on any other platform)
*/
#ifndef SkCityHash_DEFINED
#define SkCityHash_DEFINED
#include "SkTypes.h"
class SkCityHash : SkNoncopyable {
public:
/**
* Compute a 32-bit checksum for a given data block.
*
* @param data Memory address of the data block to be processed.
* @param size Size of the data block in bytes.
* @return checksum result
*/
static uint32_t Compute32(const char *data, size_t size);
/**
* Compute a 64-bit checksum for a given data block.
*
* @param data Memory address of the data block to be processed.
* @param size Size of the data block in bytes.
* @return checksum result
*/
static uint64_t Compute64(const char *data, size_t size);
};
#endif
This directory contains files needed to build third_party/externals/cityhash
(such as the config.h file that would normally be created by autoconf)
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* Converts from Skia build flags to the macro definitions cityhash normally
* gets from autoconf.
*/
#include "SkTypes.h"
#ifdef SK_CPU_BENDIAN
#define WORDS_BIGENDIAN 1
#endif
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "Test.h" #include "Test.h"
#include "SkChecksum.h" #include "SkChecksum.h"
#include "SkCityHash.h"
// Word size that is large enough to hold results of any checksum type. // Word size that is large enough to hold results of any checksum type.
typedef uint64_t checksum_result; typedef uint64_t checksum_result;
...@@ -25,9 +24,7 @@ namespace skiatest { ...@@ -25,9 +24,7 @@ namespace skiatest {
} }
private: private:
enum Algorithm { enum Algorithm {
kSkChecksum, kSkChecksum
kSkCityHash32,
kSkCityHash64
}; };
// Call Compute(data, size) on the appropriate checksum algorithm, // Call Compute(data, size) on the appropriate checksum algorithm,
...@@ -41,10 +38,6 @@ namespace skiatest { ...@@ -41,10 +38,6 @@ namespace skiatest {
REPORTER_ASSERT_MESSAGE(fReporter, SkIsAlign4(size), REPORTER_ASSERT_MESSAGE(fReporter, SkIsAlign4(size),
"test data size is not 32-bit aligned"); "test data size is not 32-bit aligned");
return SkChecksum::Compute(reinterpret_cast<const uint32_t *>(data), size); return SkChecksum::Compute(reinterpret_cast<const uint32_t *>(data), size);
case kSkCityHash32:
return SkCityHash::Compute32(data, size);
case kSkCityHash64:
return SkCityHash::Compute64(data, size);
default: default:
SkString message("fWhichAlgorithm has unknown value "); SkString message("fWhichAlgorithm has unknown value ");
message.appendf("%d", fWhichAlgorithm); message.appendf("%d", fWhichAlgorithm);
...@@ -108,31 +101,11 @@ namespace skiatest { ...@@ -108,31 +101,11 @@ namespace skiatest {
// Test self-consistency of checksum algorithms. // Test self-consistency of checksum algorithms.
fWhichAlgorithm = kSkChecksum; fWhichAlgorithm = kSkChecksum;
TestChecksumSelfConsistency(128); TestChecksumSelfConsistency(128);
fWhichAlgorithm = kSkCityHash32;
TestChecksumSelfConsistency(128);
fWhichAlgorithm = kSkCityHash64;
TestChecksumSelfConsistency(128);
// Test checksum results that should be consistent across // Test checksum results that should be consistent across
// versions and platforms. // versions and platforms.
fWhichAlgorithm = kSkChecksum; fWhichAlgorithm = kSkChecksum;
REPORTER_ASSERT(fReporter, ComputeChecksum(NULL, 0) == 0); REPORTER_ASSERT(fReporter, ComputeChecksum(NULL, 0) == 0);
fWhichAlgorithm = kSkCityHash32;
REPORTER_ASSERT(fReporter, ComputeChecksum(NULL, 0) == 0xdc56d17a);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(4) == 0x616e1132);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(8) == 0xeb0fd2d6);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(128) == 0x5321e430);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(132) == 0x924a10e4);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(256) == 0xd4de9dc9);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(260) == 0xecf0325d);
fWhichAlgorithm = kSkCityHash64;
REPORTER_ASSERT(fReporter, ComputeChecksum(NULL, 0) == 0x9ae16a3b2f90404fULL);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(4) == 0x82bffd898958e540ULL);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(8) == 0xad5a13e1e8e93b98ULL);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(128) == 0x10b153630af1f395ULL);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(132) == 0x7db71dc4adcc6647ULL);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(256) == 0xeee763519b91b010ULL);
REPORTER_ASSERT(fReporter, GetTestDataChecksum(260) == 0x2fe19e0b2239bc23ULL);
// TODO: note the weakness exposed by these collisions... // TODO: note the weakness exposed by these collisions...
// We need to improve the SkChecksum algorithm. // We need to improve the SkChecksum algorithm.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment