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

Side by Side Diff: third_party/brotli/dec/huffman.c

Issue 1915823002: Update brotli from 722f89 (Feb 19, 2016) to 510131 (Apr 22, 2016) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/brotli/dec/huffman.h ('k') | third_party/brotli/dec/port.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 2013 Google Inc. All Rights Reserved. 1 /* Copyright 2013 Google Inc. All Rights Reserved.
2 2
3 Distributed under MIT license. 3 Distributed under MIT license.
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5 */ 5 */
6 6
7 /* Utilities for building Huffman decoding tables. */ 7 /* Utilities for building Huffman decoding tables. */
8 8
9 #include "./huffman.h" 9 #include "./huffman.h"
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 int left = 1 << (len - root_bits); 92 int left = 1 << (len - root_bits);
93 while (len < BROTLI_HUFFMAN_MAX_CODE_LENGTH) { 93 while (len < BROTLI_HUFFMAN_MAX_CODE_LENGTH) {
94 left -= count[len]; 94 left -= count[len];
95 if (left <= 0) break; 95 if (left <= 0) break;
96 ++len; 96 ++len;
97 left <<= 1; 97 left <<= 1;
98 } 98 }
99 return len - root_bits; 99 return len - root_bits;
100 } 100 }
101 101
102
103 void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* table, 102 void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* table,
104 const uint8_t* const code_lengths, 103 const uint8_t* const code_lengths,
105 uint16_t* count) { 104 uint16_t* count) {
106 HuffmanCode code; /* current table entry */ 105 HuffmanCode code; /* current table entry */
107 int symbol; /* symbol index in original or sorted table */ 106 int symbol; /* symbol index in original or sorted table */
108 uint32_t key; /* prefix code */ 107 uint32_t key; /* prefix code */
109 uint32_t key_step; /* prefix code addend */ 108 uint32_t key_step; /* prefix code addend */
110 int step; /* step size to replicate values in current table */ 109 int step; /* step size to replicate values in current table */
111 int table_size; /* size of current table */ 110 int table_size; /* size of current table */
112 int sorted[18]; /* symbols sorted by code length */ 111 int sorted[18]; /* symbols sorted by code length */
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 memcpy(&table[table_size], &table[0], 347 memcpy(&table[table_size], &table[0],
349 (size_t)table_size * sizeof(table[0])); 348 (size_t)table_size * sizeof(table[0]));
350 table_size <<= 1; 349 table_size <<= 1;
351 } 350 }
352 return goal_size; 351 return goal_size;
353 } 352 }
354 353
355 #if defined(__cplusplus) || defined(c_plusplus) 354 #if defined(__cplusplus) || defined(c_plusplus)
356 } /* extern "C" */ 355 } /* extern "C" */
357 #endif 356 #endif
OLDNEW
« no previous file with comments | « third_party/brotli/dec/huffman.h ('k') | third_party/brotli/dec/port.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698