Class is the arithmetic encoding context class.
type Class int
Enumerated definitions for the encoding classes.
const (
// IAAI used to decode number of symbol instances in an aggregation.
IAAI Class = iota
// IADH used to decode difference in height between two height classes.
IADH
// IADS used to decode the S coordinate of the second and subsequent
// symbol instances in a strip.
IADS
// IADT used to decode the T coordinate of the second and subsequent
// symbol instances in a strip.
IADT
// IADW used to decode the difference in width between two symbols in
// a height class
IADW
// IAEX used to decode export flags.
IAEX
// IAFS used to decode the S coordinate of the first symbol instance
// in a strip.
IAFS
// IAIT used to decode the T coordinate of the symbol instances in a strip.
IAIT
// IARDH used to decode the delta height of symbol instance refinements.
IARDH
// IARDW used to decode the delta width of symbol instance refinements.
IARDW
// IARDX used to decode the delta X position of symbol instance refinements.
IARDX
// IARDY used to decode the delta Y position of symbol instance refinements.
IARDY
// IARI used to decode the Ri bit of symbol instances.
IARI
)
func (c Class) String() string
String implements fmt.Stringer interface.
Encoder is the jbig2 arithmetic encoder context.
type Encoder struct {
// contains filtered or unexported fields
}
func New() *Encoder
New creates new initialized arithmetic encoder.
func (e *Encoder) DataSize() int
DataSize returns the size of encoded data
func (e *Encoder) EncodeBitmap(bm *bitmap.Bitmap, duplicateLineRemoval bool) error
EncodeBitmap encodes packed data used for the 1bpp packed format image.
func (e *Encoder) EncodeIAID(symbolCodeLength, value int) (err error)
EncodeIAID encodes the integer ID 'value'. The symbol code length is the binary length of the value.
func (e *Encoder) EncodeInteger(proc Class, value int) (err error)
EncodeInteger encodes the integer 'value' for the given class 'proc'.
func (e *Encoder) EncodeOOB(proc Class) (err error)
EncodeOOB encodes out of band value for given class process.
func (e *Encoder) Final()
Final flush any remaining arithmetic encoder context to the output
func (e *Encoder) Flush()
Flush all the data stored in a context
func (e *Encoder) Init()
Init initializes a new context.
func (e *Encoder) Refine(iTemp, iTarget *bitmap.Bitmap, ox, oy int) error
Refine encodes the refinement of an exemplar to a bitmap. It encodes the differences between the template and the target image. The values 'ox, oy' are limited to [-1, 0, 1].
func (e *Encoder) Reset()
Reset the arithmetic coder back to a init state
func (e *Encoder) WriteTo(w io.Writer) (int64, error)
WriteTo implements io.WriterTo interface.