...

Package arithmetic

Overview ▾

Package arithmetic contains the jbig2 arithmetic decoder used to decode the jbig2 encoded segments.

type Decoder

Decoder is the arithmetic Decoder structure, used to decode the jbig2 Segments.

type Decoder struct {
    // ContextSize is the current decoder context size
    ContextSize          []uint32
    ReferedToContextSize []uint32
    // contains filtered or unexported fields
}

func New

func New(r bitwise.StreamReader) (*Decoder, error)

New creates new arithmetic Decoder.

func (*Decoder) DecodeBit

func (d *Decoder) DecodeBit(stats *DecoderStats) (int, error)

DecodeBit decodes a single bit using provided decoder stats.

func (*Decoder) DecodeIAID

func (d *Decoder) DecodeIAID(codeLen uint64, stats *DecoderStats) (int64, error)

DecodeIAID decodes the IAID procedure, Annex A.3.

func (*Decoder) DecodeInt

func (d *Decoder) DecodeInt(stats *DecoderStats) (int32, error)

DecodeInt decodes the Integer from the arithmetic Decoder for the provided DecoderStats.

type DecoderStats

DecoderStats is the structure that contains arithmetic decode context.

type DecoderStats struct {
    // contains filtered or unexported fields
}

func NewStats

func NewStats(contextSize int32, index int32) *DecoderStats

NewStats creates new DecoderStats of size 'contextSize'.

func (*DecoderStats) Copy

func (d *DecoderStats) Copy() *DecoderStats

Copy copies the DecoderStats.

func (*DecoderStats) Overwrite

func (d *DecoderStats) Overwrite(dNew *DecoderStats)

Overwrite overwrites the codingContextTable from new DecoderStats 'dNew'.

func (*DecoderStats) Reset

func (d *DecoderStats) Reset()

Reset resets current decoder stats.

func (*DecoderStats) SetIndex

func (d *DecoderStats) SetIndex(index int32)

SetIndex sets current decoder stats 'index'.

func (*DecoderStats) String

func (d *DecoderStats) String() string

String implements Stringer interface.