decoder

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package decoder implements the top-level H.264/AVC decoder orchestration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	TraceMBCMP  bool // emit MBCMP lines for FFmpeg comparison
	SkipDeblock bool // skip deblocking filter for debugging
	// contains filtered or unexported fields
}

Decoder is the H.264/AVC decoder.

func New

func New() *Decoder

New creates a new H.264 decoder.

func (*Decoder) DecodeAVC

func (d *Decoder) DecodeAVC(data []byte) (*frame.Frame, error)

DecodeAVC decodes the first IDR frame from AVC-format data (each NALU preceded by a 4-byte big-endian length field).

func (*Decoder) DecodeAllAVC

func (d *Decoder) DecodeAllAVC(data []byte) ([]*frame.Frame, error)

DecodeAllAVC decodes all frames from AVC-format data (each NALU preceded by a 4-byte big-endian length field).

func (*Decoder) DecodeAllAnnexB

func (d *Decoder) DecodeAllAnnexB(data []byte) ([]*frame.Frame, error)

DecodeAllAnnexB decodes all frames (IDR + P_Skip) from an Annex-B byte stream.

func (*Decoder) DecodeAllFrames

func (d *Decoder) DecodeAllFrames(nalus [][]byte) ([]*frame.Frame, error)

DecodeAllFrames decodes all frames from a set of NALUs (IDR and non-IDR). Non-IDR slices are decoded as P_Skip (copy from reference); an error is returned if a non-IDR slice contains non-skip macroblocks. Returns frames in decode order.

func (*Decoder) DecodeAnnexB

func (d *Decoder) DecodeAnnexB(data []byte) (*frame.Frame, error)

DecodeAnnexB decodes the first IDR frame from an Annex-B byte stream.

func (*Decoder) DecodeIDRAVC added in v0.9.0

func (d *Decoder) DecodeIDRAVC(data []byte) ([]*frame.Frame, error)

DecodeIDRAVC decodes only IDR frames from AVC-format data (each NALU preceded by a 4-byte big-endian length field).

func (*Decoder) DecodeIDRAnnexB added in v0.9.0

func (d *Decoder) DecodeIDRAnnexB(data []byte) ([]*frame.Frame, error)

DecodeIDRAnnexB decodes only IDR frames from an Annex-B byte stream.

func (*Decoder) DecodeIDRFrames added in v0.9.0

func (d *Decoder) DecodeIDRFrames(nalus [][]byte) ([]*frame.Frame, error)

DecodeIDRFrames decodes only IDR frames from a set of NALUs, skipping all non-IDR slices. Returns frames in decode order.

func (*Decoder) DecodeNALUs

func (d *Decoder) DecodeNALUs(nalus [][]byte) (*frame.Frame, error)

DecodeNALUs decodes a complete access unit (set of NALUs) and returns the reconstructed frame. For multi-frame streams, use DecodeAllFrames instead.

type ScalingMatrices

type ScalingMatrices struct {
	IntraY4x4  [16]int32 // Intra luma 4x4 scaling list (SPS/PPS list 0)
	IntraCb4x4 [16]int32 // Intra chroma Cb 4x4 scaling list (SPS/PPS list 1)
	IntraCr4x4 [16]int32 // Intra chroma Cr 4x4 scaling list (SPS/PPS list 2)
	IntraY8x8  [64]int32 // Intra luma 8x8 scaling list (SPS/PPS list 6)
}

ScalingMatrices holds effective scaling lists in raster order for dequantization. All lists are in raster scan order (row*width + col), converted from the zigzag scan order used in the bitstream.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL