Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: media/base/djb2.h

Issue 7572040: Enable media.dll / libmedia.so. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/data_buffer.h ('k') | media/base/filter_collection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_DJB2_H_ 5 #ifndef MEDIA_BASE_DJB2_H_
6 #define MEDIA_BASE_DJB2_H_ 6 #define MEDIA_BASE_DJB2_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "media/base/media_export.h"
9 10
10 // DJB2 is a hash algorithm with excellent distribution and speed 11 // DJB2 is a hash algorithm with excellent distribution and speed
11 // on many different sets. 12 // on many different sets.
12 // It has marginally more collisions than FNV1, but makes up for it in 13 // It has marginally more collisions than FNV1, but makes up for it in
13 // performance. 14 // performance.
14 // The return value is suitable for table lookups. 15 // The return value is suitable for table lookups.
15 // For small fixed sizes (ie a pixel), it has low overhead and inlines well. 16 // For small fixed sizes (ie a pixel), it has low overhead and inlines well.
16 // For large data sets, it optimizes into assembly/simd and is appropriate 17 // For large data sets, it optimizes into assembly/simd and is appropriate
17 // for realtime applications. 18 // for realtime applications.
18 // See Also: 19 // See Also:
19 // http://www.cse.yorku.ca/~oz/hash.html 20 // http://www.cse.yorku.ca/~oz/hash.html
20 21
21 static const uint32 kDJB2HashSeed = 5381u; 22 static const uint32 kDJB2HashSeed = 5381u;
22 23
23 // These functions perform DJB2 hash. The simplest call is DJB2Hash() to 24 // These functions perform DJB2 hash. The simplest call is DJB2Hash() to
24 // generate the DJB2 hash of the given data: 25 // generate the DJB2 hash of the given data:
25 // uint32 hash = DJB2Hash(data1, length1, kDJB2HashSeed); 26 // uint32 hash = DJB2Hash(data1, length1, kDJB2HashSeed);
26 // 27 //
27 // You can also compute the DJB2 hash of data incrementally by making multiple 28 // You can also compute the DJB2 hash of data incrementally by making multiple
28 // calls to DJB2Hash(): 29 // calls to DJB2Hash():
29 // uint32 hash_value = kDJB2HashSeed; // Initial seed for DJB2. 30 // uint32 hash_value = kDJB2HashSeed; // Initial seed for DJB2.
30 // for (size_t i = 0; i < copy_lines; ++i) { 31 // for (size_t i = 0; i < copy_lines; ++i) {
31 // hash_value = DJB2Hash(source, bytes_per_line, hash_value); 32 // hash_value = DJB2Hash(source, bytes_per_line, hash_value);
32 // source += source_stride; 33 // source += source_stride;
33 // } 34 // }
34 35
35 // For the given buffer of data, compute the DJB2 hash of 36 // For the given buffer of data, compute the DJB2 hash of
36 // the data. You can call this any number of times during the computation. 37 // the data. You can call this any number of times during the computation.
37 uint32 DJB2Hash(const void* buf, size_t len, uint32 seed); 38 MEDIA_EXPORT uint32 DJB2Hash(const void* buf, size_t len, uint32 seed);
38 39
39 #endif // MEDIA_BASE_DJB2_H_ 40 #endif // MEDIA_BASE_DJB2_H_
40 41
OLDNEW
« no previous file with comments | « media/base/data_buffer.h ('k') | media/base/filter_collection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698