docs.unity3d.com
    目次を表示する/隠す

    Struct StreamCompressionModel

    This type uses Huffman encoding to encode values in a lossless manner. When sending something like a 32-bit integer over the network, it is impractical to create a Huffman tree that encompasses every value the integer can take as it would require a tree with 2^32 leaves. To make this more practical, we lump values into a manageable number of power-of-two-sized buckets and then only code the bucket index with Huffman and code the position in the bucket using several raw bits corresponding to the size of the bucket.

    The buckets are small, around 0, and become progressively larger as you move away from zero. As most data is deltas against predictions; we expect values to be small and expect most of the redundancy to be in the error's size and not in exactly which of the values of that size we end up hitting.

    The context is as a sub-model that has its own statistics and uses its own Huffman tree. When using the context to read and write a specific value, the context must always be the same. The benefit of using multiple contexts is that it allows you to separate the statistics of things that have different expected distributions, which leads to more precise statistics, which again yields better compression. More contexts does, however, result in a marginal cost of a slightly larger model.

    Namespace: Unity.Collections
    Syntax
    public struct StreamCompressionModel

    Properties

    Default

    A shared singleton instance of StreamCompressionModel, this instance is initialized using hardcoded bucket parameters and model.

    Declaration
    public static readonly StreamCompressionModel Default { get; }
    Property Value
    Type Description
    StreamCompressionModel

    Methods

    CalculateBucket(UInt32)

    Calculates the bucket index into the Unity.Collections.StreamCompressionModel.encodeTable where the specified value should be written.

    Declaration
    public int CalculateBucket(uint value)
    Parameters
    Type Name Description
    UInt32 value

    A 4-byte unsigned integer value to find a bucket for.

    Returns
    Type Description
    Int32

    The bucket index where to put the value.

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)