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

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

Issue 2149863002: libwebp: update to v0.5.1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « third_party/libwebp/utils/bit_reader_inl.h ('k') | third_party/libwebp/utils/huffman.c » ('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 <string.h> 16 #include <string.h>
17 #include "./color_cache.h" 17 #include "./color_cache.h"
18 #include "../utils/utils.h" 18 #include "./utils.h"
19 19
20 //------------------------------------------------------------------------------ 20 //------------------------------------------------------------------------------
21 // VP8LColorCache. 21 // VP8LColorCache.
22 22
23 int VP8LColorCacheInit(VP8LColorCache* const cc, int hash_bits) { 23 int VP8LColorCacheInit(VP8LColorCache* const cc, int hash_bits) {
24 const int hash_size = 1 << hash_bits; 24 const int hash_size = 1 << hash_bits;
25 assert(cc != NULL); 25 assert(cc != NULL);
26 assert(hash_bits > 0); 26 assert(hash_bits > 0);
27 cc->colors_ = (uint32_t*)WebPSafeCalloc((uint64_t)hash_size, 27 cc->colors_ = (uint32_t*)WebPSafeCalloc((uint64_t)hash_size,
28 sizeof(*cc->colors_)); 28 sizeof(*cc->colors_));
(...skipping 11 matching lines...) Expand all
40 } 40 }
41 41
42 void VP8LColorCacheCopy(const VP8LColorCache* const src, 42 void VP8LColorCacheCopy(const VP8LColorCache* const src,
43 VP8LColorCache* const dst) { 43 VP8LColorCache* const dst) {
44 assert(src != NULL); 44 assert(src != NULL);
45 assert(dst != NULL); 45 assert(dst != NULL);
46 assert(src->hash_bits_ == dst->hash_bits_); 46 assert(src->hash_bits_ == dst->hash_bits_);
47 memcpy(dst->colors_, src->colors_, 47 memcpy(dst->colors_, src->colors_,
48 ((size_t)1u << dst->hash_bits_) * sizeof(*dst->colors_)); 48 ((size_t)1u << dst->hash_bits_) * sizeof(*dst->colors_));
49 } 49 }
OLDNEW
« no previous file with comments | « third_party/libwebp/utils/bit_reader_inl.h ('k') | third_party/libwebp/utils/huffman.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698