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

Side by Side Diff: third_party/libwebp/utils/huffman_encode.h

Issue 1546003002: libwebp: update to 0.5.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 'defines' exists Created 4 years, 12 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
OLDNEW
1 // Copyright 2011 Google Inc. All Rights Reserved. 1 // Copyright 2011 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 // Author: Jyrki Alakuijala (jyrki@google.com) 10 // Author: Jyrki Alakuijala (jyrki@google.com)
(...skipping 16 matching lines...) Expand all
27 } HuffmanTreeToken; 27 } HuffmanTreeToken;
28 28
29 // Struct to represent the tree codes (depth and bits array). 29 // Struct to represent the tree codes (depth and bits array).
30 typedef struct { 30 typedef struct {
31 int num_symbols; // Number of symbols. 31 int num_symbols; // Number of symbols.
32 uint8_t* code_lengths; // Code lengths of the symbols. 32 uint8_t* code_lengths; // Code lengths of the symbols.
33 uint16_t* codes; // Symbol Codes. 33 uint16_t* codes; // Symbol Codes.
34 } HuffmanTreeCode; 34 } HuffmanTreeCode;
35 35
36 // Struct to represent the Huffman tree. 36 // Struct to represent the Huffman tree.
37 // TODO(vikasa): Add comment for the fields of the Struct.
38 typedef struct { 37 typedef struct {
39 uint32_t total_count_; 38 uint32_t total_count_; // Symbol frequency.
40 int value_; 39 int value_; // Symbol value.
41 int pool_index_left_; // Index for the left sub-tree. 40 int pool_index_left_; // Index for the left sub-tree.
42 int pool_index_right_; // Index for the right sub-tree. 41 int pool_index_right_; // Index for the right sub-tree.
43 } HuffmanTree; 42 } HuffmanTree;
44 43
45 // Turn the Huffman tree into a token sequence. 44 // Turn the Huffman tree into a token sequence.
46 // Returns the number of tokens used. 45 // Returns the number of tokens used.
47 int VP8LCreateCompressedHuffmanTree(const HuffmanTreeCode* const tree, 46 int VP8LCreateCompressedHuffmanTree(const HuffmanTreeCode* const tree,
48 HuffmanTreeToken* tokens, int max_tokens); 47 HuffmanTreeToken* tokens, int max_tokens);
49 48
50 // Create an optimized tree, and tokenize it. 49 // Create an optimized tree, and tokenize it.
51 // 'buf_rle' and 'huff_tree' are pre-allocated and the 'tree' is the constructed 50 // 'buf_rle' and 'huff_tree' are pre-allocated and the 'tree' is the constructed
52 // huffman code tree. 51 // huffman code tree.
53 void VP8LCreateHuffmanTree(uint32_t* const histogram, int tree_depth_limit, 52 void VP8LCreateHuffmanTree(uint32_t* const histogram, int tree_depth_limit,
54 uint8_t* const buf_rle, HuffmanTree* const huff_tree, 53 uint8_t* const buf_rle, HuffmanTree* const huff_tree,
55 HuffmanTreeCode* const tree); 54 HuffmanTreeCode* const tree);
56 55
57 #ifdef __cplusplus 56 #ifdef __cplusplus
58 } 57 }
59 #endif 58 #endif
60 59
61 #endif // WEBP_UTILS_HUFFMAN_ENCODE_H_ 60 #endif // WEBP_UTILS_HUFFMAN_ENCODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698