suica/jxl/modular does not have a README file

    ChannelShift

    pub(all) enum ChannelShift {
    JpegUpsampling(has_h_subsample~ : Bool, h_subsample~ : Bool, has_v_subsample~ : Bool, v_subsample~ : Bool)
    Shifts(Int)
    Raw(Int, Int)
    } derive(Eq,
    Debug
    )

    ChannelShift::from_jpeg_upsampling

    fn ChannelShift::from_jpeg_upsampling(jpeg_upsampling : FixedArray[Int], idx : Int) -> ChannelShift

    ChannelShift::from_shift

    fn ChannelShift::from_shift(shift : Int) -> ChannelShift

    ChannelShift::hshift

    fn ChannelShift::hshift(self : ChannelShift) -> Int

    ChannelShift::shift_size

    fn ChannelShift::shift_size(self : ChannelShift, size : (Int, Int)) -> (Int, Int)

    ChannelShift::vshift

    fn ChannelShift::vshift(self : ChannelShift) -> Int

    FlatMaTree

    pub struct FlatMaTree {
    // private fields
    }

    A "flat" meta-adaptive tree, constructed with MaConfig::make_flat_tree.

    FlatMaTree::decode_sample

    fn FlatMaTree::decode_sample(self : FlatMaTree, bs :
    Bitstream
    , decoder :
    Decoder
    , properties : PredictorState, dist_multiplier : Int) -> (Int, Predictor) raise
    JxlError

    Decode a sample with the given state.

    FlatMaTree::get_leaf

    fn FlatMaTree::get_leaf(self : FlatMaTree, properties : PredictorState) -> MaTreeLeafClustered

    Walks the tree with the properties computed in properties.

    FlatMaTree::max_prev_channel_depth

    fn FlatMaTree::max_prev_channel_depth(self : FlatMaTree) -> Int

    Returns the number of previously decoded channels needed in order to traverse the MA tree.

    FlatMaTree::need_self_correcting

    fn FlatMaTree::need_self_correcting(self : FlatMaTree) -> Bool

    Returns whether self-correcting predictor should be initialized.

    MaConfig

    pub struct MaConfig {
    // private fields
    }

    Meta-adaptive tree configuration.

    Meta-adaptive (MA) tree is a decision tree that controls how the sample is decoded in the given context. The configuration consists of two components: the MA tree itself, and the distribution information of an entropy decoder. These components are read from the bitstream.

    MaConfig::decoder

    Returns the entropy decoder.

    The decoder should be cloned to be used for decoding.

    MaConfig::make_flat_tree

    fn MaConfig::make_flat_tree(self : MaConfig, channel : Int, stream_idx : Int, prev_channels : Int) -> FlatMaTree

    Creates a simplified MA tree with given channel index and stream index, which then can be used to decode samples.

    The method will evaluate the tree with the given information and prune branches which are always not taken.

    MaConfig::num_tree_nodes

    fn MaConfig::num_tree_nodes(self : MaConfig) -> Int

    Returns the number of MA tree nodes.

    MaConfig::tree_depth

    fn MaConfig::tree_depth(self : MaConfig) -> Int

    Returns the maximum distance from root to any leaf node.

    MaConfigParams

    pub(all) struct MaConfigParams {
    tracker :
    AllocTracker
    ?
    node_limit : Int
    depth_limit : Int
    }

    Parameters for decoding MaConfig.

    MaTreeLeafClustered

    pub(all) struct MaTreeLeafClustered {
    cluster : Int
    predictor : Predictor
    offset : Int
    multiplier : Int
    } derive(Eq,
    Debug
    )

    Modular

    pub struct Modular {
    // private fields
    }

    A Modular encoded image.

    Modular image decoding is done in two steps:
    1. Construct a value of Modular by either:
      • reading a Modular header from the bitstream, or
      • creating a subimage of existing image.
    2. Decode pixels.

    Samples are always Int (upstream's Sample = i32).

    Modular::empty

    fn Modular::empty() -> Modular

    Creates an empty Modular image.

    Modular::has_palette

    fn Modular::has_palette(self : Modular) -> Bool

    Modular::has_squeeze

    fn Modular::has_squeeze(self : Modular) -> Bool

    Modular::image

    Modular::image_mut

    fn Modular::image_mut(self : Modular) -> ModularImageDestination?

    Same as image (MoonBit values are shared references).

    Modular::into_image

    fn Modular::into_image(self : Modular) -> ModularImageDestination?

    Modular::try_clone

    fn Modular::try_clone(self : Modular) -> Modular

    ModularChannelInfo

    pub struct ModularChannelInfo {
    width : Int
    height : Int
    original_width : Int
    original_height : Int
    hshift : Int
    vshift : Int
    original_shift : ChannelShift
    } derive(
    Debug
    )

    Channel information. Values are immutable; transforms replace them.

    ModularChannelInfo::original_size

    fn ModularChannelInfo::original_size(self : ModularChannelInfo) -> (Int, Int)

    ModularChannelInfo::shift

    ModularChannelParams

    pub(all) struct ModularChannelParams {
    width : Int
    height : Int
    shift : ChannelShift
    } derive(
    Debug
    )

    ModularChannelParams::jpeg

    fn ModularChannelParams::jpeg(width : Int, height : Int, jpeg_upsampling : FixedArray[Int], idx : Int) -> ModularChannelParams

    ModularChannelParams::new

    fn ModularChannelParams::new(width : Int, height : Int) -> ModularChannelParams

    ModularChannelParams::with_shift

    fn ModularChannelParams::with_shift(width : Int, height : Int, shift : ChannelShift) -> ModularChannelParams

    ModularHeader

    pub(all) struct ModularHeader {
    use_global_tree : Bool
    wp_params : WpHeader
    nb_transforms : Int
    transform : Array[TransformInfo]
    } derive(
    Debug
    )

    ModularImageDestination

    pub struct ModularImageDestination {
    // private fields
    }

    ModularImageDestination::has_palette

    fn ModularImageDestination::has_palette(self : ModularImageDestination) -> Bool

    ModularImageDestination::has_squeeze

    fn ModularImageDestination::has_squeeze(self : ModularImageDestination) -> Bool

    ModularImageDestination::image_channels

    ModularImageDestination::into_image_channels

    ModularImageDestination::into_image_channels_with_info

    ModularImageDestination::prepare_gmodular

    The subimage of channels decoded in the GlobalModular section: meta channels and channels not larger than a group.

    ModularImageDestination::prepare_groups

    Splits the channels not decoded in GlobalModular into LF groups and pass groups. pass_shifts maps pass index to its (minshift, maxshift).

    ModularImageDestination::prepare_subimage

    ModularImageDestination::try_clone

    ModularParams

    pub(all) struct ModularParams {
    group_dim : Int
    bit_depth : Int
    channels : Array[ModularChannelParams]
    ma_config : MaConfig?
    tracker :
    AllocTracker
    ?
    narrow_buffer : Bool
    }

    Parameters for decoding a Modular image (jxl-modular ModularParams).

    ModularParams::new

    fn ModularParams::new(width : Int, height : Int, group_dim : Int, bit_depth : Int, channel_shifts : Array[ChannelShift], ma_config : MaConfig?, tracker :
    AllocTracker
    ?) -> ModularParams

    ModularParams::with_channels

    fn ModularParams::with_channels(group_dim : Int, bit_depth : Int, channels : Array[ModularChannelParams], ma_config : MaConfig?, tracker :
    AllocTracker
    ?) -> ModularParams

    Palette

    pub(all) struct Palette {
    begin_c : Int
    num_c : Int
    nb_colours : Int
    nb_deltas : Int
    d_pred : Predictor
    wp_header : WpHeader?
    } derive(
    Debug
    )

    Predictor

    pub(all) enum Predictor {
    Zero
    West
    North
    AvgWestAndNorth
    Select
    Gradient
    SelfCorrecting
    NorthEast
    NorthWest
    WestWest
    AvgWestAndNorthWest
    AvgNorthAndNorthWest
    AvgNorthAndNorthEast
    AvgAll
    } derive(Eq,
    Debug
    )

    Predictor::predict

    fn Predictor::predict(self : Predictor, state : PredictorState) -> Int

    Predicts the current sample from the properties computed by PredictorState::properties (upstream Predictor::predict::<EDGE = true>; the non-edge specialisation computes the same values).

    Predictor::try_from

    fn Predictor::try_from(value : UInt) -> Predictor raise
    JxlError

    Predictor::try_from(u32).

    PredictorState

    pub struct PredictorState {
    // private fields
    }

    Predictor state of a channel being decoded.

    Upstream splits this into PredictorState and a short-lived Properties value per sample. To avoid a per-sample allocation, the Properties data (property cache and the self-correcting prediction) lives here: properties() computes it, get_property() reads it (Properties::get) and record() consumes it (Properties::record).

    PredictorState::get_property

    fn PredictorState::get_property(self : PredictorState, property : Int) -> Int

    Properties::get.

    PredictorState::new

    PredictorState::properties

    fn PredictorState::properties(self : PredictorState) -> Unit

    Computes the properties of the current sample (upstream PredictorState::properties), including the self-correcting prediction if enabled.

    PredictorState::record

    fn PredictorState::record(self : PredictorState, sample : Int) -> Unit

    Properties::record: stores the decoded sample and advances.

    PredictorState::reset

    fn PredictorState::reset(self : PredictorState, width : Int, prev_channels_rev : ArrayView[
    SubGrid
    [Int]], wp_header : WpHeader?) -> Unit

    Rct

    pub(all) struct Rct {
    begin_c : Int
    rct_type : Int
    } derive(
    Debug
    )

    RecursiveModularImage

    pub struct RecursiveModularImage {
    // private fields
    }

    RecursiveModularImage::prepare_subimage

    Squeeze

    pub(all) struct Squeeze {
    num_sq : Int
    sp : Array[SqueezeParams]
    } derive(
    Debug
    )

    SqueezeParams

    pub(all) struct SqueezeParams {
    horizontal : Bool
    in_place : Bool
    begin_c : Int
    num_c : Int
    } derive(
    Debug
    )

    TransformInfo

    pub(all) enum TransformInfo {
    Rct(Rct)
    Palette(Palette)
    Squeeze(Squeeze)
    } derive(
    Debug
    )

    TransformInfo::is_palette

    fn TransformInfo::is_palette(self : TransformInfo) -> Bool

    TransformInfo::is_squeeze

    fn TransformInfo::is_squeeze(self : TransformInfo) -> Bool

    TransformedGlobalModular

    pub(all) struct TransformedGlobalModular {
    lf_groups : Array[TransformedModularSubimage]
    pass_groups : Array[Array[TransformedModularSubimage]]
    }

    TransformedGrid

    pub struct TransformedGrid {
    // private fields
    }

    A channel grid view after transforms (upstream TransformedGrid).

    Upstream is Single(grid) or Merged { leader, members }; here members is empty for Single.

    TransformedGrid::from

    TransformedGrid::grid

    TransformedModularSubimage

    pub struct TransformedModularSubimage {
    // private fields
    }

    TransformedModularSubimage::channel_indices

    fn TransformedModularSubimage::channel_indices(self : TransformedModularSubimage) -> Array[Int]

    Indices of the channels of this subimage in the parent image.

    TransformedModularSubimage::decode

    Decodes the channels of the subimage. With allow_partial, an unexpected end of stream leaves the image partially decoded.

    TransformedModularSubimage::finish

    Applies inverse transforms. Returns whether the image was fully decoded.

    TransformedModularSubimage::is_empty

    TransformedModularSubimage::is_partial

    TransformedModularSubimage::recursive

    Reads the local Modular header of a group and returns the group image.
    pub(all) struct WpHeader {
    default_wp : Bool
    wp_p1 : Int
    wp_p2 : Int
    wp_p3a : Int
    wp_p3b : Int
    wp_p3c : Int
    wp_p3d : Int
    wp_p3e : Int
    wp_w0 : Int
    wp_w1 : Int
    wp_w2 : Int
    wp_w3 : Int
    } derive(Eq,
    Debug
    )

    Self-correcting (weighted) predictor parameters.

    WpHeader::default

    fn WpHeader::default() -> WpHeader