Versions in this module Expand all Collapse all v1 v1.0.1 Jun 30, 2026 v1.0.0 Jun 30, 2026 Changes in this version + const MarkerCAP + const MarkerCDT + const MarkerCOM + const MarkerCRG + const MarkerCTS + const MarkerCWD + const MarkerEOC + const MarkerNLT + const MarkerPIH + const MarkerSLH + const MarkerSOC + const MarkerWGT + const MaxQuantizationParameter + const MinCAPDataSize + const MinCDTDataSize + const MinPIHDataSize + const MinQuantizationParameter + const MinWGTDataSize + var ErrBufferModelViolation = errors.New("buffer model violation") + var ErrContainerFormatError = errors.New("container format error") + var ErrEntropyDecodingFailed = errors.New("entropy decoding failed") + var ErrFrameExtractionFailed = errors.New("frame extraction failed") + var ErrInvalidCAP = errors.New("invalid CAP marker") + var ErrInvalidCDT = errors.New("invalid CDT marker") + var ErrInvalidCodestream = errors.New("invalid JPEG XS codestream") + var ErrInvalidLevel = errors.New("invalid JPEG XS level indicator") + var ErrInvalidMarker = errors.New("invalid marker segment") + var ErrInvalidPrecinct = errors.New("invalid precinct parameters") + var ErrInvalidProfile = errors.New("invalid JPEG XS profile indicator") + var ErrInvalidQuantization = errors.New("invalid quantization parameters") + var ErrInvalidSlice = errors.New("invalid slice data") + var ErrInvalidWGT = errors.New("invalid WGT marker") + var ErrLineBufferExceeded = errors.New("line buffer size exceeds maximum") + var ErrMarkerLengthExceeded = errors.New("marker segment length exceeds maximum") + var ErrMissingPIH = errors.New("missing PIH marker") + var ErrMissingSOC = errors.New("missing SOC marker") + var ErrRateControlFailed = errors.New("rate control parameters invalid") + var ErrSubbandSizeExceeded = errors.New("subband size exceeds maximum") + var ErrTimingInfoMissing = errors.New("timing information missing") + var ErrTruncatedCodestream = errors.New("truncated codestream data") + var ErrUnsupportedBitDepth = errors.New("unsupported bit depth") + var ErrUnsupportedLevel = errors.New("unsupported JPEG XS level") + var ErrUnsupportedProfile = errors.New("unsupported JPEG XS profile") + var ErrUnsupportedSampling = errors.New("unsupported chroma sampling") + var ErrWaveletLevelExceeded = errors.New("wavelet decomposition level exceeds maximum") + func DetectJPEGXS(data []byte) bool + func GetMarkerName(marker uint16) string + type BandWeight struct + Band uint8 + Weight uint8 + type BoundedWaveletAllocator struct + func NewBoundedWaveletAllocator(width, height, levels int) (*BoundedWaveletAllocator, error) + func (a *BoundedWaveletAllocator) AllocateLineBuffer() ([]int32, error) + func (a *BoundedWaveletAllocator) AllocateSubbandBuffer(level int) ([]int32, error) + func (a *BoundedWaveletAllocator) EstimatedMemory() int64 + func (a *BoundedWaveletAllocator) Release() + type BufferModel struct + func NewBufferModel(bufferSize int, targetBitrate int64) *BufferModel + func (b *BufferModel) AddSlice(bits int) error + func (b *BufferModel) DrainBits(bits int) + func (b *BufferModel) Fullness() float64 + func (b *BufferModel) Size() int + type CAP struct + Length uint16 + Level Level + Profile Profile + RawBytes []byte + Sublevel Sublevel + func (c *CAP) Validate() error + type CDT struct + Components []ComponentDefinition + Length uint16 + func (c *CDT) Validate() error + type COM struct + Data []byte + Length uint16 + RegistrationType uint16 + func (c *COM) Validate() error + type ChromaSampling uint8 + const ChromaSampling420 + const ChromaSampling422 + const ChromaSampling444 + const ChromaSamplingUnknown + func (c ChromaSampling) String() string + type ComponentDefinition struct + BitDepth uint8 + SamplingX uint8 + SamplingY uint8 + Signed bool + type Decoder struct + func NewDecoder(data []byte) (*Decoder, error) + func NewDecoderWithOptions(data []byte, options *DecoderOptions) (*Decoder, error) + func (d *Decoder) Decode() ([]byte, error) + func (d *Decoder) DecodeProgressive(callback func(lineNumber int, data []byte) error) error + func (d *Decoder) DecodeToImage() (image.Image, error) + func (d *Decoder) GetInfo() *ImageInfo + func (d *Decoder) GetLatencyLines() int + func (d *Decoder) GetLevel() Level + func (d *Decoder) GetMemoryBound() int64 + func (d *Decoder) GetProfile() Profile + func (d *Decoder) IsLossless() bool + func (d *Decoder) IsLowLatency() bool + type DecoderOptions struct + IgnoreWarnings bool + LowLatencyMode bool + MaxLineBuffers int + TargetBitDepth int + ValidateChecksums bool + func DefaultDecoderOptions() *DecoderOptions + type Encoder struct + func NewEncoder(opts ...EncoderOption) *Encoder + func (e *Encoder) Configure(width, height, componentCount int) error + func (e *Encoder) CountEntropyOperations(coeffs []int32) int + func (e *Encoder) Encode(w io.Writer, input []byte) error + func (e *Encoder) EncodeCoefficients(coeffs []int32) ([]byte, error) + func (e *Encoder) ForwardWaveletTransform(input []byte) (*SubbandData, error) + func (e *Encoder) GetBitsPerPixel(encodedSize int) float64 + func (e *Encoder) GetLatencyLines() int + func (e *Encoder) GetMemoryBound() int64 + func (e *Encoder) GetSliceBitBudget() int + func (e *Encoder) GetSubbands() (*SubbandData, error) + func (e *Encoder) ProcessLine(lineNum int, data []byte) error + func (e *Encoder) ReportSliceBits(bits int) + func (e *Encoder) ResetLineState() + type EncoderOption func(*Encoder) + func WithBitDepth(depth int) EncoderOption + func WithLowLatencyMode(enabled bool) EncoderOption + func WithProfile(profile Profile) EncoderOption + func WithTargetBitrate(bitrate int64) EncoderOption + type EntropyDecoder struct + func NewEntropyDecoder() *EntropyDecoder + func (d *EntropyDecoder) DecodeCoefficients(data []byte, numCoeffs int, bitDepth int) ([]int32, error) + type EntropyEncoder struct + func NewEntropyEncoder() *EntropyEncoder + func (e *EntropyEncoder) CountOperations(coeffs []int32) int + func (e *EntropyEncoder) EncodeCoefficients(coeffs []int32, bitDepth int) ([]byte, error) + type ImageInfo struct + BitDepth int + ChromaSampling ChromaSampling + ComponentCount int + CompressedSize int64 + CompressionRatio float64 + Height int + IsLossless bool + Level Level + Profile Profile + SliceCount int + Sublevel Sublevel + WaveletLevelsX int + WaveletLevelsY int + Width int + func (i *ImageInfo) GetOutputSize(bytesPerSample int) (int, error) + func (i *ImageInfo) Validate() error + type Level uint8 + const Level10K + const Level1K + const Level2K + const Level4K + const Level8K + const LevelUnknown + func (l Level) IsValid() bool + func (l Level) MaxHeight() int + func (l Level) MaxWidth() int + func (l Level) String() string + type LineBasedWaveletReconstructor struct + func NewLineBasedWaveletReconstructor(width, height, levels int) (*LineBasedWaveletReconstructor, error) + func (r *LineBasedWaveletReconstructor) ReconstructLine(lineNum int) ([]int32, error) + func (r *LineBasedWaveletReconstructor) SetSubbands(subbands *SubbandData) error + type LineBuffer struct + ComponentIndex int + Data []int32 + Height int + SubbandIndex int + Width int + func (lb *LineBuffer) Validate() error + type LinedBasedWaveletProcessor struct + func NewLinedBasedWaveletProcessor(width, height, levels int) (*LinedBasedWaveletProcessor, error) + func (p *LinedBasedWaveletProcessor) GetSubbands() (*SubbandData, error) + func (p *LinedBasedWaveletProcessor) ProcessLine(line []int32) error + type PIH struct + BitDepth uint8 + ComponentCount uint8 + FragmentationFlag bool + Height int + Length uint16 + PrecinctWidth int + Profile Profile + QuantizationStyle uint8 + RawBytes []byte + RefineFlag bool + SliceHeight int + WaveletLevelsX uint8 + WaveletLevelsY uint8 + Width int + func (p *PIH) Validate() error + type Parser struct + func NewParser(data []byte) *Parser + func NewParserWithOffset(data []byte, offset int64) *Parser + func (p *Parser) ParseCAP() (*CAP, error) + func (p *Parser) ParseCDT() (*CDT, error) + func (p *Parser) ParseMarker() (uint16, error) + func (p *Parser) ParsePIH() (*PIH, error) + func (p *Parser) ParseSOC() error + func (p *Parser) ParseWGT() (*WGT, error) + func (p *Parser) Position() int + func (p *Parser) Remaining() int + func (p *Parser) RouteMarker() (uint16, interface{}, error) + func (p *Parser) SetPosition(pos int) + type Precinct struct + BudgetBytes int + Data []byte + Index int + Width int + type Profile uint16 + const ProfileHLS + const ProfileHigh + const ProfileLight + const ProfileLight44412 + const ProfileMLS + const ProfileMain + const ProfileUnknown + func (p Profile) IsLossless() bool + func (p Profile) IsValid() bool + func (p Profile) String() string + type RateControl struct + BitsPerPixel float64 + BufferSize int + MaxQuantization int + MinQuantization int + TargetBitrate int64 + func (rc *RateControl) Validate() error + type RateController struct + func NewRateController(targetBPP float64, imageWidth, imageHeight, sliceHeight int) *RateController + func (rc *RateController) GetQuantizationParameter() int + func (rc *RateController) GetSliceBitBudget() int + func (rc *RateController) ReportSliceBits(actualBits int) + type RunLengthDecoder struct + func NewRunLengthDecoder() *RunLengthDecoder + func (d *RunLengthDecoder) Decode(entries []RunLengthEntry, expectedLength int) []int32 + type RunLengthEncoder struct + func NewRunLengthEncoder() *RunLengthEncoder + func (e *RunLengthEncoder) Encode(coeffs []int32) []RunLengthEntry + type RunLengthEntry struct + RunLength int + Value int32 + type SLH struct + DataOffset int + Length uint16 + SliceIndex uint16 + func (s *SLH) Validate() error + type SignificanceDecoder struct + func NewSignificanceDecoder() *SignificanceDecoder + func (d *SignificanceDecoder) DecodeBlock(bitmap []byte, numCoeffs int) []bool + func (d *SignificanceDecoder) Reset() + type SignificanceEncoder struct + func NewSignificanceEncoder() *SignificanceEncoder + func (e *SignificanceEncoder) EncodeBlock(coeffs []int32) []byte + func (e *SignificanceEncoder) EncodeSignificance(coeff int32) (significant bool, context int) + func (e *SignificanceEncoder) Reset() + type Subband struct + BitDepth int + Height int + Level int + Orientation SubbandOrientation + Width int + func (s *Subband) Validate() error + type SubbandData struct + HH []int32 + HHHeight int + HHWidth int + HL []int32 + HLHeight int + HLWidth int + LH []int32 + LHHeight int + LHWidth int + LL []int32 + LLHeight int + LLWidth int + type SubbandOrientation uint8 + const SubbandHH + const SubbandHL + const SubbandLH + const SubbandLL + func (o SubbandOrientation) String() string + type Sublevel uint8 + const Sublevel420 + const Sublevel422 + const Sublevel444 + const SublevelBayer + const SublevelFull + const SublevelUnknown + func (s Sublevel) String() string + type WGT struct + Length uint16 + Weights []BandWeight + func (w *WGT) Validate() error + type WaveletCoeffs2D struct + Data []int32 + HHHeight int + HHWidth int + HLHeight int + HLWidth int + Height int + LHHeight int + LHWidth int + LLHeight int + LLWidth int + Width int + type WaveletDecomposition struct + Height int + Levels []WaveletLevel + NumLevels int + Width int + type WaveletLevel struct + HH []int32 + HHHeight int + HHWidth int + HL []int32 + HLHeight int + HLWidth int + LH []int32 + LHHeight int + LHWidth int + LL []int32 + LLHeight int + LLWidth int + type WaveletTransform53 struct + func NewWaveletTransform53() *WaveletTransform53 + func (t *WaveletTransform53) Forward1D(input []int32) (lo, hi []int32) + func (t *WaveletTransform53) Forward2D(data []int32, width, height int) (*WaveletCoeffs2D, error) + func (t *WaveletTransform53) ForwardMultiLevel(data []int32, width, height, levels int) (*WaveletDecomposition, error) + func (t *WaveletTransform53) Inverse1D(lo, hi []int32) []int32 + func (t *WaveletTransform53) Inverse2D(coeffs *WaveletCoeffs2D) ([]int32, error) + func (t *WaveletTransform53) InverseMultiLevel(decomp *WaveletDecomposition) ([]int32, error)