| OLD | NEW |
| 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 // API for Brotli compression | 7 // API for Brotli compression |
| 8 | 8 |
| 9 #ifndef BROTLI_ENC_ENCODE_H_ | 9 #ifndef BROTLI_ENC_ENCODE_H_ |
| 10 #define BROTLI_ENC_ENCODE_H_ | 10 #define BROTLI_ENC_ENCODE_H_ |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // but we do not use either of them in quality 0. | 173 // but we do not use either of them in quality 0. |
| 174 uint8_t cmd_depths_[128]; | 174 uint8_t cmd_depths_[128]; |
| 175 uint16_t cmd_bits_[128]; | 175 uint16_t cmd_bits_[128]; |
| 176 // The compressed form of the command and distance prefix codes for the next | 176 // The compressed form of the command and distance prefix codes for the next |
| 177 // block in quality 0. | 177 // block in quality 0. |
| 178 uint8_t cmd_code_[512]; | 178 uint8_t cmd_code_[512]; |
| 179 size_t cmd_code_numbits_; | 179 size_t cmd_code_numbits_; |
| 180 // Command and literal buffers for quality 1. | 180 // Command and literal buffers for quality 1. |
| 181 uint32_t* command_buf_; | 181 uint32_t* command_buf_; |
| 182 uint8_t* literal_buf_; | 182 uint8_t* literal_buf_; |
| 183 |
| 184 int is_last_block_emitted_; |
| 183 }; | 185 }; |
| 184 | 186 |
| 185 // Compresses the data in input_buffer into encoded_buffer, and sets | 187 // Compresses the data in input_buffer into encoded_buffer, and sets |
| 186 // *encoded_size to the compressed length. | 188 // *encoded_size to the compressed length. |
| 187 // Returns 0 if there was an error and 1 otherwise. | 189 // Returns 0 if there was an error and 1 otherwise. |
| 188 int BrotliCompressBuffer(BrotliParams params, | 190 int BrotliCompressBuffer(BrotliParams params, |
| 189 size_t input_size, | 191 size_t input_size, |
| 190 const uint8_t* input_buffer, | 192 const uint8_t* input_buffer, |
| 191 size_t* encoded_size, | 193 size_t* encoded_size, |
| 192 uint8_t* encoded_buffer); | 194 uint8_t* encoded_buffer); |
| 193 | 195 |
| 194 // Same as above, but uses the specified input and output classes instead | 196 // Same as above, but uses the specified input and output classes instead |
| 195 // of reading from and writing to pre-allocated memory buffers. | 197 // of reading from and writing to pre-allocated memory buffers. |
| 196 int BrotliCompress(BrotliParams params, BrotliIn* in, BrotliOut* out); | 198 int BrotliCompress(BrotliParams params, BrotliIn* in, BrotliOut* out); |
| 197 | 199 |
| 198 // Before compressing the data, sets a custom LZ77 dictionary with | 200 // Before compressing the data, sets a custom LZ77 dictionary with |
| 199 // BrotliCompressor::BrotliSetCustomDictionary. | 201 // BrotliCompressor::BrotliSetCustomDictionary. |
| 200 int BrotliCompressWithCustomDictionary(size_t dictsize, const uint8_t* dict, | 202 int BrotliCompressWithCustomDictionary(size_t dictsize, const uint8_t* dict, |
| 201 BrotliParams params, | 203 BrotliParams params, |
| 202 BrotliIn* in, BrotliOut* out); | 204 BrotliIn* in, BrotliOut* out); |
| 203 | 205 |
| 204 | 206 |
| 205 } // namespace brotli | 207 } // namespace brotli |
| 206 | 208 |
| 207 #endif // BROTLI_ENC_ENCODE_H_ | 209 #endif // BROTLI_ENC_ENCODE_H_ |
| OLD | NEW |