fortplot_zlib_compress Module

Deflate compression, CRC32, and Adler-32 checksum implementation Extracted from fortplot_zlib_core for size compliance (Issue #1747)



Functions

public function bit_reverse(value, num_bits) result(reversed_value)

Reverses the bits of a given value up to num_bits.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: value
integer, intent(in) :: num_bits

Return Value integer

public function zlib_compress(input_data, input_len, output_len) result(output_data)

Backwards-compatible wrapper returning an allocatable result

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: input_data(*)
integer, intent(in) :: input_len
integer, intent(out) :: output_len

Return Value integer(kind=int8), allocatable, (:)


Subroutines

public subroutine deflate_compress(input_data, input_len, output_data, output_len)

Full deflate compression implementation with LZ77 and Huffman coding

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: input_data(*)
integer, intent(in) :: input_len
integer(kind=int8), intent(out), allocatable :: output_data(:)
integer, intent(out) :: output_len

public subroutine init_fixed_huffman_tables(literal_codes, literal_lengths, distance_codes, distance_lengths)

Initialize fixed Huffman tables as per RFC 1951

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: literal_codes(0:285)
integer, intent(out) :: literal_lengths(0:285)
integer, intent(out) :: distance_codes(0:29)
integer, intent(out) :: distance_lengths(0:29)

public subroutine zlib_compress_into(input_data, input_len, output_data, output_len)

Compress data into a newly allocated buffer with zlib wrapper

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: input_data(*)
integer, intent(in) :: input_len
integer(kind=int8), intent(out), allocatable :: output_data(:)
integer, intent(out) :: output_len