package core:compress
⌘K
Ctrl+K
or
/
Overview
A collection of utilities to aid with other compression packages.
Index
Constants (2)
Variables (0)
This section is empty.
Procedures (27)
- COMPRESS_OUTPUT_ALLOCATE_MAX
- Context_Memory_Input
- Context_Stream_Input
- Error
- consume_bits_lsb_from_memory
- consume_bits_lsb_from_stream
- discard_to_next_byte_lsb_from_memory
- discard_to_next_byte_lsb_from_stream
- input_size_from_memory
- input_size_from_stream
- peek_back_byte
- peek_bits_lsb_from_stream
- peek_bits_no_refill_lsb_from_memory
- peek_bits_no_refill_lsb_from_stream
- peek_data_at_offset_from_memory
- peek_data_at_offset_from_stream
- peek_data_from_memory
- peek_data_from_stream
- read_bits_lsb_from_stream
- read_bits_no_refill_lsb_from_memory
- read_bits_no_refill_lsb_from_stream
- read_data
- read_slice_from_stream
- read_u8_from_memory
- read_u8_from_stream
- read_u8_prefer_code_buffer_lsb
- refill_lsb_from_stream
Types
Context_Memory_Input ¶
Context_Memory_Input :: struct #packed { input_data: []u8, output: ^bytes.Buffer, bytes_written: i64, code_buffer: u64, num_bits: u64, size_packed: i64, size_unpacked: i64, }
General I/O context for ZLIB, LZW, etc.
Related Procedures With Parameters
- consume_bits_lsb_from_memory
- discard_to_next_byte_lsb_from_memory
- input_size_from_memory
- peek_bits_lsb_from_memory
- peek_bits_no_refill_lsb_from_memory
- peek_data_at_offset_from_memory
- peek_data_from_memory
- read_bits_lsb_from_memory
- read_bits_no_refill_lsb_from_memory
- read_slice_from_memory
- read_u8_from_memory
- refill_lsb_from_memory
- consume_bits_lsb (procedure groups)
- discard_to_next_byte_lsb (procedure groups)
- input_size (procedure groups)
- peek_bits_lsb (procedure groups)
- peek_bits_no_refill_lsb (procedure groups)
- peek_data (procedure groups)
- read_bits_lsb (procedure groups)
- read_bits_no_refill_lsb (procedure groups)
- read_slice (procedure groups)
- read_u8 (procedure groups)
- refill_lsb (procedure groups)
Context_Stream_Input ¶
Context_Stream_Input :: struct #packed { input_data: []u8, input: io.Stream, output: ^bytes.Buffer, bytes_written: i64, code_buffer: u64, num_bits: u64, size_packed: i64, size_unpacked: i64, input_fully_in_memory: b8, padding: [1]u8, }
Related Procedures With Parameters
- consume_bits_lsb_from_stream
- discard_to_next_byte_lsb_from_stream
- input_size_from_stream
- peek_bits_lsb_from_stream
- peek_bits_no_refill_lsb_from_stream
- peek_data_at_offset_from_stream
- peek_data_from_stream
- read_bits_lsb_from_stream
- read_bits_no_refill_lsb_from_stream
- read_slice_from_stream
- read_u8_from_stream
- refill_lsb_from_stream
- consume_bits_lsb (procedure groups)
- discard_to_next_byte_lsb (procedure groups)
- input_size (procedure groups)
- peek_bits_lsb (procedure groups)
- peek_bits_no_refill_lsb (procedure groups)
- peek_data (procedure groups)
- read_bits_lsb (procedure groups)
- read_bits_no_refill_lsb (procedure groups)
- read_slice (procedure groups)
- read_u8 (procedure groups)
- refill_lsb (procedure groups)
Deflate_Error ¶
Deflate_Error :: enum int { None = 0, Huffman_Bad_Sizes, Huffman_Bad_Code_Lengths, Inflate_Error, Bad_Distance, Bad_Huffman_Code, Len_Nlen_Mismatch, BType_3, }
GZIP_Error ¶
GZIP_Error :: General_Error
ZIP_Error ¶
ZIP_Error :: enum int { None = 0, Invalid_ZIP_File_Signature, Unexpected_Signature, Insert_Next_Disk, Expected_End_of_Central_Directory_Record, }
ZLIB_Error ¶
ZLIB_Error :: enum int { None = 0, Unsupported_Window_Size, FDICT_Unsupported, Unsupported_Compression_Level, Code_Buffer_Malformed, }
peek_bits_lsb_from_memory ¶
peek_bits_lsb_from_memory :: Error
Related Procedures With Returns
- input_size_from_memory
- input_size_from_stream
- input_size (procedure groups)
peek_bits_lsb_from_stream ¶
peek_bits_lsb_from_stream :: GZIP_Error
Constants
COMPRESS_OUTPUT_ALLOCATE_MIN ¶
COMPRESS_OUTPUT_ALLOCATE_MIN :: int(#config(COMPRESS_OUTPUT_ALLOCATE_MIN, 1 << 20))
When a decompression routine doesn't stream its output, but writes to a buffer, we pre-allocate an output buffer to speed up decompression. The default is 1 MiB.
discard_to_next_byte_lsb ¶
discard_to_next_byte_lsb :: COMPRESS_OUTPUT_ALLOCATE_MAX
For 64-bit platforms, we set the default max buffer size to 4 GiB, which is GZIP and PKZIP's max payload size.
Variables
This section is empty.
Procedures
COMPRESS_OUTPUT_ALLOCATE_MAX ¶
COMPRESS_OUTPUT_ALLOCATE_MAX :: peek_bits_lsb_from_stream
Related Procedure Groups
Context_Stream_Input ¶
Context_Stream_Input :: read_data
consume_bits_lsb_from_memory ¶
consume_bits_lsb_from_memory :: proc(z: ^Context_Memory_Input, width: u8) {…}
Related Procedure Groups
consume_bits_lsb_from_stream ¶
consume_bits_lsb_from_stream :: proc(z: ^Context_Stream_Input, width: u8) {…}
Related Procedure Groups
discard_to_next_byte_lsb_from_memory ¶
discard_to_next_byte_lsb_from_memory :: proc(z: ^Context_Memory_Input) {…}
Related Procedure Groups
discard_to_next_byte_lsb_from_stream ¶
discard_to_next_byte_lsb_from_stream :: read_bits_lsb_from_memory
Related Procedure Groups
input_size_from_memory ¶
input_size_from_memory :: proc(z: ^Context_Memory_Input) -> (res: i64, err: Error) {…}
Related Procedure Groups
input_size_from_stream ¶
input_size_from_stream :: peek_bits_lsb_from_memory
Related Procedure Groups
peek_back_byte ¶
Sliding window read back
peek_bits_lsb_from_stream ¶
peek_bits_lsb_from_stream :: discard_to_next_byte_lsb_from_stream
Related Procedure Groups
peek_bits_no_refill_lsb_from_memory ¶
peek_bits_no_refill_lsb_from_memory :: proc(z: ^Context_Memory_Input, width: u8) -> u32 {…}
Related Procedure Groups
peek_bits_no_refill_lsb_from_stream ¶
peek_bits_no_refill_lsb_from_stream :: proc(z: ^Context_Stream_Input, width: u8) -> u32 {…}
Related Procedure Groups
peek_data_at_offset_from_memory ¶
peek_data_at_offset_from_memory :: proc(z: ^Context_Memory_Input, $T: typeid, #any_int offset: int) -> (res: typeid, err: io.Error) {…}
Related Procedure Groups
peek_data_at_offset_from_stream ¶
peek_data_at_offset_from_stream :: proc(z: ^Context_Stream_Input, $T: typeid, #any_int offset: int) -> (res: typeid, err: io.Error) {…}
Related Procedure Groups
peek_data_from_memory ¶
peek_data_from_memory :: proc(z: ^Context_Memory_Input, $T: typeid) -> (res: typeid, err: io.Error) {…}
Related Procedure Groups
peek_data_from_stream ¶
peek_data_from_stream :: proc(z: ^Context_Stream_Input, $T: typeid) -> (res: typeid, err: io.Error) {…}
Related Procedure Groups
read_bits_lsb_from_stream ¶
read_bits_lsb_from_stream :: proc(z: ^Context_Stream_Input, width: u8) -> u32 {…}
Related Procedure Groups
read_bits_no_refill_lsb_from_memory ¶
read_bits_no_refill_lsb_from_memory :: proc(z: ^Context_Memory_Input, width: u8) -> u32 {…}
Related Procedure Groups
read_bits_no_refill_lsb_from_stream ¶
read_bits_no_refill_lsb_from_stream :: proc(z: ^Context_Stream_Input, width: u8) -> u32 {…}
Related Procedure Groups
read_slice_from_stream ¶
read_slice_from_stream :: proc(z: ^Context_Stream_Input, size: int) -> (res: []u8, err: io.Error) {…}
Related Procedure Groups
read_u8_from_memory ¶
read_u8_from_memory :: proc(z: ^Context_Memory_Input) -> (res: u8, err: io.Error) {…}
Related Procedure Groups
read_u8_from_stream ¶
read_u8_from_stream :: proc(z: ^Context_Stream_Input) -> (res: u8, err: io.Error) {…}
Related Procedure Groups
read_u8_prefer_code_buffer_lsb ¶
You would typically only use this at the end of Inflate, to drain bits from the code buffer preferentially.
refill_lsb_from_stream ¶
refill_lsb_from_stream :: proc(z: ^Context_Stream_Input, width: i8 = i8(24)) {…}
Generalized bit reader LSB
Related Procedure Groups
Procedure Groups
consume_bits_lsb ¶
consume_bits_lsb :: proc{ consume_bits_lsb_from_memory, consume_bits_lsb_from_stream, }
discard_to_next_byte_lsb ¶
discard_to_next_byte_lsb :: proc{ discard_to_next_byte_lsb_from_memory, discard_to_next_byte_lsb_from_stream, }
input_size ¶
input_size :: proc{ input_size_from_memory, input_size_from_stream, }
peek_bits_lsb ¶
peek_bits_lsb :: proc{ peek_bits_lsb_from_memory, peek_bits_lsb_from_stream, }
peek_bits_no_refill_lsb ¶
peek_bits_no_refill_lsb :: proc{ peek_bits_no_refill_lsb_from_memory, peek_bits_no_refill_lsb_from_stream, }
peek_data ¶
peek_data :: proc{ peek_data_from_memory, peek_data_from_stream, peek_data_at_offset_from_memory, peek_data_at_offset_from_stream, }
read_bits_lsb ¶
read_bits_lsb :: proc{ read_bits_lsb_from_memory, read_bits_lsb_from_stream, }
read_bits_no_refill_lsb ¶
read_bits_no_refill_lsb :: proc{ read_bits_no_refill_lsb_from_memory, read_bits_no_refill_lsb_from_stream, }
read_slice ¶
read_slice :: proc{ read_slice_from_memory, read_slice_from_stream, }
read_u8 ¶
read_u8 :: proc{ read_u8_from_memory, read_u8_from_stream, }
refill_lsb ¶
refill_lsb :: proc{ refill_lsb_from_memory, refill_lsb_from_stream, }
Source Files
Generation Information
Generated with odin version dev-2026-03 (vendor "odin") Windows_amd64 @ 2026-03-16 21:30:53.629204300 +0000 UTC