| 1 | /* Copyright 2022 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 | /* Encoder state. */ |
| 8 | |
| 9 | #ifndef BROTLI_ENC_STATE_H_ |
| 10 | #define BROTLI_ENC_STATE_H_cxx . . $ `c/enc/state.h:10:9`! |
| 11 | |
| 12 | #include "../common/constants.h"cxx . . $ `<file>/c/common/constants.h`/ |
| 13 | #include "../common/platform.h"cxx . . $ `<file>/c/common/platform.h`/ |
| 14 | #include "command.h"cxx . . $ `<file>/c/enc/command.h`/ |
| 15 | #include "compress_fragment.h"cxx . . $ `<file>/c/enc/compress_fragment.h`/ |
| 16 | #include "compress_fragment_two_pass.h"cxx . . $ `<file>/c/enc/compress_fragment_two_pass.h`/ |
| 17 | #include "hash.h"cxx . . $ `<file>/c/enc/hash.h`/ |
| 18 | #include "memory.h"cxx . . $ `<file>/c/enc/memory.h`/ |
| 19 | #include "params.h"cxx . . $ `<file>/c/enc/params.h`/ |
| 20 | #include "ringbuffer.h"cxx . . $ `<file>/c/enc/ringbuffer.h`/ |
| 21 | |
| 22 | typedef enum BrotliEncoderStreamStatecxx . . $ BrotliEncoderStreamState# { |
| 23 | /* Default state. */ |
| 24 | BROTLI_STREAM_PROCESSINGcxx . . $ BROTLI_STREAM_PROCESSING. = 0, |
| 25 | /* Intermediate state; after next block is emitted, byte-padding should be |
| 26 | performed before getting back to default state. */ |
| 27 | BROTLI_STREAM_FLUSH_REQUESTEDcxx . . $ BROTLI_STREAM_FLUSH_REQUESTED. = 1, |
| 28 | /* Last metablock was produced; no more input is acceptable. */ |
| 29 | BROTLI_STREAM_FINISHEDcxx . . $ BROTLI_STREAM_FINISHED. = 2, |
| 30 | /* Flushing compressed block and writing meta-data block header. */ |
| 31 | BROTLI_STREAM_METADATA_HEADcxx . . $ BROTLI_STREAM_METADATA_HEAD. = 3, |
| 32 | /* Writing metadata block body. */ |
| 33 | BROTLI_STREAM_METADATA_BODYcxx . . $ BROTLI_STREAM_METADATA_BODY. = 4 |
| 34 | } BrotliEncoderStreamStatecxx . . $ BrotliEncoderStreamState#; |
| 35 | |
| 36 | typedef enum BrotliEncoderFlintStatecxx . . $ BrotliEncoderFlintState# { |
| 37 | BROTLI_FLINT_NEEDS_2_BYTEScxx . . $ BROTLI_FLINT_NEEDS_2_BYTES. = 2, |
| 38 | BROTLI_FLINT_NEEDS_1_BYTEcxx . . $ BROTLI_FLINT_NEEDS_1_BYTE. = 1, |
| 39 | BROTLI_FLINT_WAITING_FOR_PROCESSINGcxx . . $ BROTLI_FLINT_WAITING_FOR_PROCESSING. = 0, |
| 40 | BROTLI_FLINT_WAITING_FOR_FLUSHINGcxx . . $ BROTLI_FLINT_WAITING_FOR_FLUSHING. = -1, |
| 41 | BROTLI_FLINT_DONEcxx . . $ BROTLI_FLINT_DONE. = -2 |
| 42 | } BrotliEncoderFlintStatecxx . . $ BrotliEncoderFlintState#; |
| 43 | |
| 44 | typedef struct BrotliEncoderStateStructcxx . . $ BrotliEncoderStateStruct# { |
| 45 | BrotliEncoderParamscxx . . $ BrotliEncoderParams# paramscxx . . $ BrotliEncoderStateStruct#params.; |
| 46 | |
| 47 | MemoryManagercxx . . $ MemoryManager# memory_manager_cxx . . $ BrotliEncoderStateStruct#memory_manager_.; |
| 48 | |
| 49 | uint64_tcxx . . $ uint64_t# input_pos_cxx . . $ BrotliEncoderStateStruct#input_pos_.; |
| 50 | RingBuffercxx . . $ RingBuffer# ringbuffer_cxx . . $ BrotliEncoderStateStruct#ringbuffer_.; |
| 51 | size_t cmd_alloc_size_cxx . . $ BrotliEncoderStateStruct#cmd_alloc_size_.; |
| 52 | Commandcxx . . $ Command#* commands_cxx . . $ BrotliEncoderStateStruct#commands_.; |
| 53 | size_t num_commands_cxx . . $ BrotliEncoderStateStruct#num_commands_.; |
| 54 | size_t num_literals_cxx . . $ BrotliEncoderStateStruct#num_literals_.; |
| 55 | size_t last_insert_len_cxx . . $ BrotliEncoderStateStruct#last_insert_len_.; |
| 56 | uint64_tcxx . . $ uint64_t# last_flush_pos_cxx . . $ BrotliEncoderStateStruct#last_flush_pos_.; |
| 57 | uint64_tcxx . . $ uint64_t# last_processed_pos_cxx . . $ BrotliEncoderStateStruct#last_processed_pos_.; |
| 58 | int dist_cache_cxx . . $ BrotliEncoderStateStruct#dist_cache_.[BROTLI_NUM_DISTANCE_SHORT_CODEScxx . . $ `c/common/constants.h:58:9`!]; |
| 59 | int saved_dist_cache_cxx . . $ BrotliEncoderStateStruct#saved_dist_cache_.[4]; |
| 60 | uint16_tcxx . . $ uint16_t# last_bytes_cxx . . $ BrotliEncoderStateStruct#last_bytes_.; |
| 61 | uint8_tcxx . . $ uint8_t# last_bytes_bits_cxx . . $ BrotliEncoderStateStruct#last_bytes_bits_.; |
| 62 | /* "Flint" is a tiny uncompressed block emitted before the continuation |
| 63 | block to unwire literal context from previous data. Despite being int8_t, |
| 64 | field is actually BrotliEncoderFlintState enum. */ |
| 65 | int8_tcxx . . $ int8_t# flint_cxx . . $ BrotliEncoderStateStruct#flint_.; |
| 66 | uint8_tcxx . . $ uint8_t# prev_byte_cxx . . $ BrotliEncoderStateStruct#prev_byte_.; |
| 67 | uint8_tcxx . . $ uint8_t# prev_byte2_cxx . . $ BrotliEncoderStateStruct#prev_byte2_.; |
| 68 | size_t storage_size_cxx . . $ BrotliEncoderStateStruct#storage_size_.; |
| 69 | uint8_tcxx . . $ uint8_t#* storage_cxx . . $ BrotliEncoderStateStruct#storage_.; |
| 70 | |
| 71 | Hashercxx . . $ Hasher# hasher_cxx . . $ BrotliEncoderStateStruct#hasher_.; |
| 72 | |
| 73 | /* Hash table for FAST_ONE_PASS_COMPRESSION_QUALITY mode. */ |
| 74 | int small_table_cxx . . $ BrotliEncoderStateStruct#small_table_.[1 << 10]; /* 4KiB */ |
| 75 | int* large_table_cxx . . $ BrotliEncoderStateStruct#large_table_.; /* Allocated only when needed */ |
| 76 | size_t large_table_size_cxx . . $ BrotliEncoderStateStruct#large_table_size_.; |
| 77 | |
| 78 | BrotliOnePassArenacxx . . $ BrotliOnePassArena#* one_pass_arena_cxx . . $ BrotliEncoderStateStruct#one_pass_arena_.; |
| 79 | BrotliTwoPassArenacxx . . $ BrotliTwoPassArena#* two_pass_arena_cxx . . $ BrotliEncoderStateStruct#two_pass_arena_.; |
| 80 | |
| 81 | /* Command and literal buffers for FAST_TWO_PASS_COMPRESSION_QUALITY. */ |
| 82 | uint32_tcxx . . $ uint32_t#* command_buf_cxx . . $ BrotliEncoderStateStruct#command_buf_.; |
| 83 | uint8_tcxx . . $ uint8_t#* literal_buf_cxx . . $ BrotliEncoderStateStruct#literal_buf_.; |
| 84 | |
| 85 | uint64_tcxx . . $ uint64_t# total_in_cxx . . $ BrotliEncoderStateStruct#total_in_.; |
| 86 | uint8_tcxx . . $ uint8_t#* next_out_cxx . . $ BrotliEncoderStateStruct#next_out_.; |
| 87 | size_t available_out_cxx . . $ BrotliEncoderStateStruct#available_out_.; |
| 88 | uint64_tcxx . . $ uint64_t# total_out_cxx . . $ BrotliEncoderStateStruct#total_out_.; |
| 89 | /* Temporary buffer for padding flush bits or metadata block header / body. */ |
| 90 | unioncxx . . $ BrotliEncoderStateStruct#$anonymous_type_0# { |
| 91 | uint64_tcxx . . $ uint64_t# u64cxx . . $ BrotliEncoderStateStruct#$anonymous_type_0#u64.[2]; |
| 92 | uint8_tcxx . . $ uint8_t# u8cxx . . $ BrotliEncoderStateStruct#$anonymous_type_0#u8.[16]; |
| 93 | } tiny_buf_cxx . . $ BrotliEncoderStateStruct#tiny_buf_.; |
| 94 | uint32_tcxx . . $ uint32_t# remaining_metadata_bytes_cxx . . $ BrotliEncoderStateStruct#remaining_metadata_bytes_.; |
| 95 | BrotliEncoderStreamStatecxx . . $ BrotliEncoderStreamState# stream_state_cxx . . $ BrotliEncoderStateStruct#stream_state_.; |
| 96 | |
| 97 | BROTLI_BOOLcxx . . $ `c/include/brotli/types.h:49:9`! is_last_block_emitted_cxx . . $ BrotliEncoderStateStruct#is_last_block_emitted_.; |
| 98 | BROTLI_BOOLcxx . . $ `c/include/brotli/types.h:49:9`! is_initialized_cxx . . $ BrotliEncoderStateStruct#is_initialized_.; |
| 99 | } BrotliEncoderStateStructcxx . . $ BrotliEncoderStateStruct#; |
| 100 | |
| 101 | typedef struct BrotliEncoderStateStructcxx . . $ BrotliEncoderStateStruct# BrotliEncoderStateInternalcxx . . $ BrotliEncoderStateInternal#; |
| 102 | #define BrotliEncoderStatecxx . . $ `c/enc/state.h:102:9`! BrotliEncoderStateInternal |
| 103 | |
| 104 | #endif // BROTLI_ENC_STATE_H_ |