package core:compress/ppmd

⌘K
Ctrl+K
or
/

    Overview

    An implementation of the PPMd compression methods

    Reads and writes raw PPMd var.H streams as stored in 7z (method 03 04 01), and raw PPMd var.I rev.1 streams as stored in zip (method 98). It is a port of Igor Pavlov's public domain code from the LZMA SDK and 7-Zip, and the encoder's output is byte-identical to 7-Zip's.

    Types

    Level ¶

    Level :: enum i32 {
    	Level_0 = 0, 
    	Level_1 = 1, 
    	Level_2 = 2, 
    	Level_3 = 3, 
    	Level_4 = 4, 
    	Level_5 = 5, 
    	Level_6 = 6, 
    	Level_7 = 7, 
    	Level_8 = 8, 
    	Level_9 = 9, 
    	Fastest = Level_0, 
    	Default = Level_5, 
    	Best    = Level_9, 
    }

    Properties ¶

    Properties :: struct {
    	variant:  Variant,
    	order:    u8,
    	mem_size: u32,
    	restore:  Restore_Method,
    }

    Related Procedures With Parameters

    Related Procedures With Returns

    Restore_Method ¶

    Restore_Method :: enum u8 {
    	Restart = 0, 
    	Cut_Off = 1, 
    	Freeze  = 2, 
    }

    Variant ¶

    Variant :: enum u8 {
    	H, 
    	I, 
    }

    Constants

    CUT_OFF_MEM_SIZE_MIN ¶

    CUT_OFF_MEM_SIZE_MIN :: (1 + 256 / 2) * 12 * 4 / 3

    MEMORY_MAX ¶

    MEMORY_MAX :: int(#config(PPMD_MEMORY_MAX, MEM_SIZE_MAX))

    MEM_SIZE_MAX ¶

    MEM_SIZE_MAX :: 0xFFFF_FFFF - 12 * 3

    ZIP_MEM_SIZE_MAX ¶

    ZIP_MEM_SIZE_MAX :: 256 << 20

    Variables

    This section is empty.

    Procedures

    compress_to_dynamic ¶

    compress_to_dynamic :: proc(
    	output:     ^[dynamic]u8, 
    	input:      []u8, 
    	props:      Properties, 
    	end_marker: bool = false, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    compress_to_slice ¶

    compress_to_slice :: proc(
    	output, input: []u8, 
    	props:         Properties, 
    	end_marker:    bool = false, 
    	allocator := context.allocator, 
    ) -> (written: int, err: compress.Error) {…}

    decode_properties_7z ¶

    decode_properties_7z :: proc "contextless" (data: []u8) -> (props: Properties, err: compress.Error) {…}

    decode_properties_zip ¶

    decode_properties_zip :: proc "contextless" (data: []u8) -> (props: Properties, err: compress.Error) {…}

    decompress_from_bytes ¶

    decompress_from_bytes :: proc(
    	output:               ^[dynamic]u8, 
    	input:                []u8, 
    	props:                Properties, 
    	expected_output_size: int = -1, 
    	max_output_size:      int = compress.COMPRESS_OUTPUT_ALLOCATE_MAX, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    decompress_from_context ¶

    decompress_from_context :: proc(
    	z:                    ^compress.Context, 
    	props:                Properties, 
    	expected_output_size: int = -1, 
    	max_output_size:      int = compress.COMPRESS_OUTPUT_ALLOCATE_MAX, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    encode_properties_7z ¶

    encode_properties_7z :: proc "contextless" (props: Properties) -> (data: [5]u8, err: compress.Error) {…}

    encode_properties_zip ¶

    encode_properties_zip :: proc "contextless" (props: Properties) -> (data: [2]u8, err: compress.Error) {…}

    level_properties ¶

    level_properties :: proc "contextless" (
    	variant:    Variant, 
    	level:      Level = Level.Default, 
    	input_size: int = -1, 
    ) -> (props: Properties) {…}

    Procedure Groups

    Source Files

    Generation Information

    Generated with odin version dev-2026-11 (vendor "odin") Windows_amd64 @ 2026-11-10 03:07:04.374188700 +0000 UTC