| OLD | NEW |
| (Empty) | |
| 1 /* Copyright 2013 Google Inc. All Rights Reserved. |
| 2 |
| 3 Distributed under MIT license. |
| 4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT |
| 5 */ |
| 6 |
| 7 // Block split point selection utilities. |
| 8 |
| 9 #ifndef BROTLI_ENC_BLOCK_SPLITTER_H_ |
| 10 #define BROTLI_ENC_BLOCK_SPLITTER_H_ |
| 11 |
| 12 #include <vector> |
| 13 |
| 14 #include "./command.h" |
| 15 #include "./metablock.h" |
| 16 #include "./types.h" |
| 17 |
| 18 namespace brotli { |
| 19 |
| 20 struct BlockSplitIterator { |
| 21 explicit BlockSplitIterator(const BlockSplit& split) |
| 22 : split_(split), idx_(0), type_(0), length_(0) { |
| 23 if (!split.lengths.empty()) { |
| 24 length_ = split.lengths[0]; |
| 25 } |
| 26 } |
| 27 |
| 28 void Next(void) { |
| 29 if (length_ == 0) { |
| 30 ++idx_; |
| 31 type_ = split_.types[idx_]; |
| 32 length_ = split_.lengths[idx_]; |
| 33 } |
| 34 --length_; |
| 35 } |
| 36 |
| 37 const BlockSplit& split_; |
| 38 size_t idx_; |
| 39 size_t type_; |
| 40 size_t length_; |
| 41 }; |
| 42 |
| 43 void CopyLiteralsToByteArray(const Command* cmds, |
| 44 const size_t num_commands, |
| 45 const uint8_t* data, |
| 46 const size_t offset, |
| 47 const size_t mask, |
| 48 std::vector<uint8_t>* literals); |
| 49 |
| 50 void SplitBlock(const Command* cmds, |
| 51 const size_t num_commands, |
| 52 const uint8_t* data, |
| 53 const size_t offset, |
| 54 const size_t mask, |
| 55 BlockSplit* literal_split, |
| 56 BlockSplit* insert_and_copy_split, |
| 57 BlockSplit* dist_split); |
| 58 |
| 59 } // namespace brotli |
| 60 |
| 61 #endif // BROTLI_ENC_BLOCK_SPLITTER_H_ |
| OLD | NEW |