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

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

Issue 10832153: libwebp: update snapshot to v0.2.0-rc1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
OLDNEW
(Empty)
1 // Copyright 2012 Google Inc. All Rights Reserved.
2 //
3 // This code is licensed under the same terms as WebM:
4 // Software License Agreement: http://www.webmproject.org/license/software/
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 // -----------------------------------------------------------------------------
7 //
8 // Color Cache for WebP Lossless
9 //
10 // Author: Jyrki Alakuijala (jyrki@google.com)
11
12 #include <assert.h>
13 #include <stdlib.h>
14 #include "./color_cache.h"
15 #include "../utils/utils.h"
16
17 #if defined(__cplusplus) || defined(c_plusplus)
18 extern "C" {
19 #endif
20
21 //------------------------------------------------------------------------------
22 // VP8LColorCache.
23
24 int VP8LColorCacheInit(VP8LColorCache* const cc, int hash_bits) {
25 const int hash_size = 1 << hash_bits;
26 assert(cc != NULL);
27 assert(hash_bits > 0);
28 cc->colors_ = (uint32_t*)WebPSafeCalloc((uint64_t)hash_size,
29 sizeof(*cc->colors_));
30 if (cc->colors_ == NULL) return 0;
31 cc->hash_shift_ = 32 - hash_bits;
32 return 1;
33 }
34
35 void VP8LColorCacheClear(VP8LColorCache* const cc) {
36 if (cc != NULL) {
37 free(cc->colors_);
38 cc->colors_ = NULL;
39 }
40 }
41
42 #if defined(__cplusplus) || defined(c_plusplus)
43 }
44 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698