| OLD | NEW |
| 1 /* Copyright 2010 Google Inc. All Rights Reserved. | 1 /* Copyright 2010 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 // A (forgetful) hash table to the data seen by the compressor, to | 7 // A (forgetful) hash table to the data seen by the compressor, to |
| 8 // help create backward references to previous data. | 8 // help create backward references to previous data. |
| 9 | 9 |
| 10 #ifndef BROTLI_ENC_HASH_H_ | 10 #ifndef BROTLI_ENC_HASH_H_ |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 delete[] forest_; | 649 delete[] forest_; |
| 650 } | 650 } |
| 651 | 651 |
| 652 void Reset() { | 652 void Reset() { |
| 653 need_init_ = true; | 653 need_init_ = true; |
| 654 } | 654 } |
| 655 | 655 |
| 656 void Init(int lgwin, size_t position, size_t bytes, bool is_last) { | 656 void Init(int lgwin, size_t position, size_t bytes, bool is_last) { |
| 657 if (need_init_) { | 657 if (need_init_) { |
| 658 window_mask_ = (1u << lgwin) - 1u; | 658 window_mask_ = (1u << lgwin) - 1u; |
| 659 invalid_pos_ = static_cast<uint32_t>(-window_mask_); | 659 invalid_pos_ = static_cast<uint32_t>(0 - window_mask_); |
| 660 for (uint32_t i = 0; i < kBucketSize; i++) { | 660 for (uint32_t i = 0; i < kBucketSize; i++) { |
| 661 buckets_[i] = invalid_pos_; | 661 buckets_[i] = invalid_pos_; |
| 662 } | 662 } |
| 663 size_t num_nodes = (position == 0 && is_last) ? bytes : window_mask_ + 1; | 663 size_t num_nodes = (position == 0 && is_last) ? bytes : window_mask_ + 1; |
| 664 forest_ = new uint32_t[2 * num_nodes]; | 664 forest_ = new uint32_t[2 * num_nodes]; |
| 665 need_init_ = false; | 665 need_init_ = false; |
| 666 } | 666 } |
| 667 } | 667 } |
| 668 | 668 |
| 669 // Finds all backward matches of &data[cur_ix & ring_buffer_mask] up to the | 669 // Finds all backward matches of &data[cur_ix & ring_buffer_mask] up to the |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 H6* hash_h6; | 965 H6* hash_h6; |
| 966 H7* hash_h7; | 966 H7* hash_h7; |
| 967 H8* hash_h8; | 967 H8* hash_h8; |
| 968 H9* hash_h9; | 968 H9* hash_h9; |
| 969 H10* hash_h10; | 969 H10* hash_h10; |
| 970 }; | 970 }; |
| 971 | 971 |
| 972 } // namespace brotli | 972 } // namespace brotli |
| 973 | 973 |
| 974 #endif // BROTLI_ENC_HASH_H_ | 974 #endif // BROTLI_ENC_HASH_H_ |
| OLD | NEW |