Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Class: RT.ArithmeticCoding.ArithmeticSymbolArrayContext

Summary

Implements a symbol context best suited for relatively small ranges of valid symbols. Supports efficient updates of individual symbol frequencies. The smallest symbol supported is 0, and the memory usage goes up linearly with the largest valid symbol.

Constructors

ArithmeticSymbolArrayContext(int length, Func<int, uint> initializer = null)
Initializes a new instance of ArithmeticSymbolArrayContext.
ArithmeticSymbolArrayContext(uint[] frequencies)

Instance methods

uint
GetSymbolFrequency(int symbol)
Returns the frequency of the specified symbol.
uint
GetSymbolPosition(int symbol)
Returns the sum of the frequencies of all symbols less than symbol.
uintReturns the sum of all symbol frequencies.
void
IncrementSymbolFrequency(int symbol, int incrementBy = 1)
Updates the frequency of the specified symbol by adding incrementBy to it.
void
SetSymbolFrequency(int symbol, uint newFrequency)
Updates the frequency of the specified symbol. To update a large number of frequencies in one go more efficiently, use ArithmeticSymbolArrayContext.UpdateFrequencies(Action<uint[]>).
void
UpdateFrequencies(Action<uint[]> updater)
Updates the frequencies of all symbols. Use this method to update a large number of frequencies. Use ArithmeticSymbolArrayContext.SetSymbolFrequency(int, uint) to update a small number of frequencies more efficiently.
void
UpdateFrequencies(Func<uint[], uint[]> updater)

Static fields

uint The maximum sum of all symbol frequencies. The encoder/decoder can overflow if the sum of all frequencies exceeds this value.