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

Side by Side Diff: third_party/libwebp/utils/color_cache.c

Issue 116213006: Update libwebp to 0.4.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: After Blink Roll Created 6 years, 11 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 | « third_party/libwebp/utils/color_cache.h ('k') | third_party/libwebp/utils/filters.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 2012 Google Inc. All Rights Reserved. 1 // Copyright 2012 Google Inc. All Rights Reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license 3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source 4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found 5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may 6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree. 7 // be found in the AUTHORS file in the root of the source tree.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 // 9 //
10 // Color Cache for WebP Lossless 10 // Color Cache for WebP Lossless
11 // 11 //
12 // Author: Jyrki Alakuijala (jyrki@google.com) 12 // Author: Jyrki Alakuijala (jyrki@google.com)
13 13
14 #include <assert.h> 14 #include <assert.h>
15 #include <stdlib.h> 15 #include <stdlib.h>
16 #include "./color_cache.h" 16 #include "./color_cache.h"
17 #include "../utils/utils.h" 17 #include "../utils/utils.h"
18 18
19 #if defined(__cplusplus) || defined(c_plusplus)
20 extern "C" {
21 #endif
22
23 //------------------------------------------------------------------------------ 19 //------------------------------------------------------------------------------
24 // VP8LColorCache. 20 // VP8LColorCache.
25 21
26 int VP8LColorCacheInit(VP8LColorCache* const cc, int hash_bits) { 22 int VP8LColorCacheInit(VP8LColorCache* const cc, int hash_bits) {
27 const int hash_size = 1 << hash_bits; 23 const int hash_size = 1 << hash_bits;
28 assert(cc != NULL); 24 assert(cc != NULL);
29 assert(hash_bits > 0); 25 assert(hash_bits > 0);
30 cc->colors_ = (uint32_t*)WebPSafeCalloc((uint64_t)hash_size, 26 cc->colors_ = (uint32_t*)WebPSafeCalloc((uint64_t)hash_size,
31 sizeof(*cc->colors_)); 27 sizeof(*cc->colors_));
32 if (cc->colors_ == NULL) return 0; 28 if (cc->colors_ == NULL) return 0;
33 cc->hash_shift_ = 32 - hash_bits; 29 cc->hash_shift_ = 32 - hash_bits;
34 return 1; 30 return 1;
35 } 31 }
36 32
37 void VP8LColorCacheClear(VP8LColorCache* const cc) { 33 void VP8LColorCacheClear(VP8LColorCache* const cc) {
38 if (cc != NULL) { 34 if (cc != NULL) {
39 free(cc->colors_); 35 free(cc->colors_);
40 cc->colors_ = NULL; 36 cc->colors_ = NULL;
41 } 37 }
42 } 38 }
43 39
44 #if defined(__cplusplus) || defined(c_plusplus)
45 }
46 #endif
OLDNEW
« no previous file with comments | « third_party/libwebp/utils/color_cache.h ('k') | third_party/libwebp/utils/filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698