Documentation
¶
Index ¶
- Constants
- Variables
- type Context
- type Decoder
- func (d *Decoder) Decode(ctx int) (uint8, error)
- func (d *Decoder) DecodeRaw() (uint8, error)
- func (d *Decoder) GetContext(index int) (*Context, error)
- func (d *Decoder) Init() error
- func (d *Decoder) MarkerFound() bool
- func (d *Decoder) Position() int
- func (d *Decoder) Reset()
- func (d *Decoder) SetContext(index int, state, mps uint8) error
- func (d *Decoder) SetData(data []byte)
- type Encoder
- type State
Constants ¶
View Source
const ( // NumStates is the number of states in MQ-coder NumStates = 47 // InitialA is the initial interval register value InitialA = 0x8000 // MaxContexts is the maximum number of contexts (JPEG 2000 uses up to 19 contexts for EBCOT) MaxContexts = 19 // MaxDecisions is the maximum decisions per code-block (safety limit) MaxDecisions = 1000000 MaxRenormIterations = 100 // Max renormalization iterations )
MQ-Coder constants
Variables ¶
View Source
var ( ErrInvalidContext = errors.New("invalid context index") ErrInvalidState = errors.New("invalid state index") ErrUnexpectedEOF = errors.New("unexpected end of data") ErrMaxDecisions = errors.New("maximum decisions exceeded") )
Errors
View Source
var StateTable = [NumStates]State{
{0x5601, 1, 1, 1},
{0x3401, 2, 6, 0},
{0x1801, 3, 9, 0},
{0x0AC1, 4, 12, 0},
{0x0521, 5, 29, 0},
{0x0221, 38, 33, 0},
{0x5601, 7, 6, 1},
{0x5401, 8, 14, 0},
{0x4801, 9, 14, 0},
{0x3801, 10, 14, 0},
{0x3001, 11, 17, 0},
{0x2401, 12, 18, 0},
{0x1C01, 13, 20, 0},
{0x1601, 29, 21, 0},
{0x5601, 15, 14, 1},
{0x5401, 16, 14, 0},
{0x5101, 17, 15, 0},
{0x4801, 18, 16, 0},
{0x3801, 19, 17, 0},
{0x3401, 20, 18, 0},
{0x3001, 21, 19, 0},
{0x2801, 22, 19, 0},
{0x2401, 23, 20, 0},
{0x2201, 24, 21, 0},
{0x1C01, 25, 22, 0},
{0x1801, 26, 23, 0},
{0x1601, 27, 24, 0},
{0x1401, 28, 25, 0},
{0x1201, 29, 26, 0},
{0x1101, 30, 27, 0},
{0x0AC1, 31, 28, 0},
{0x09C1, 32, 29, 0},
{0x08A1, 33, 30, 0},
{0x0521, 34, 31, 0},
{0x0441, 35, 32, 0},
{0x02A1, 36, 33, 0},
{0x0221, 37, 34, 0},
{0x0141, 38, 35, 0},
{0x0111, 39, 36, 0},
{0x0085, 40, 37, 0},
{0x0049, 41, 38, 0},
{0x0025, 42, 39, 0},
{0x0015, 43, 40, 0},
{0x0009, 44, 41, 0},
{0x0005, 45, 42, 0},
{0x0001, 45, 43, 0},
{0x5601, 46, 46, 0},
}
StateTable contains the 47 MQ-coder states. Based on JPEG 2000 standard (ITU-T T.800 / ISO/IEC 15444-1)
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
State uint8 // Current state index (0-46)
MPS uint8 // Most Probable Symbol (0 or 1)
}
Context represents an MQ-coder context
type Decoder ¶
type Decoder struct {
// Registers
A uint32 // Interval register (16-bit effective)
C uint32 // Code register (32-bit, lower 16 bits active)
CT uint8 // Bit counter
// contains filtered or unexported fields
}
Decoder represents an MQ-coder decoder
func (*Decoder) GetContext ¶
GetContext returns the context at the given index
func (*Decoder) Init ¶
Init initializes the MQ decoder This follows the INITDEC procedure from the JPEG 2000 standard
func (*Decoder) MarkerFound ¶
MarkerFound returns true if a marker was encountered
func (*Decoder) SetContext ¶
SetContext sets the context state and MPS
type Encoder ¶
type Encoder struct {
// Registers
A uint32 // Interval register
C uint32 // Code register
CT uint8 // Bit counter
BP int // Byte pointer
// State
BPST int // Start byte pointer
// contains filtered or unexported fields
}
Encoder represents an MQ-coder encoder
func (*Encoder) GetContext ¶
GetContext returns the context at given index
Click to show internal directories.
Click to hide internal directories.