dependencydescriptor

package
v0.0.0-...-c2cc3df Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxSpatialIds    = 4
	MaxTemporalIds   = 8
	MaxDecodeTargets = 32
	MaxTemplates     = 64

	AllChainsAreActive = uint32(0)

	ExtensionURI = "https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension"
)

Variables

View Source
var (
	ErrDDReaderNoStructure              = errors.New("DependencyDescriptorReader: Structure is nil")
	ErrDDReaderTemplateWithoutStructure = errors.New("DependencyDescriptorReader: has templateDependencyStructurePresentFlag but AttachedStructure is nil")
	ErrDDReaderTooManyTemplates         = errors.New("DependencyDescriptorReader: too many templates")
	ErrDDReaderTooManyTemporalLayers    = errors.New("DependencyDescriptorReader: too many temporal layers")
	ErrDDReaderTooManySpatialLayers     = errors.New("DependencyDescriptorReader: too many spatial layers")
	ErrDDReaderInvalidTemplateIndex     = errors.New("DependencyDescriptorReader: invalid template index")
	ErrDDReaderInvalidSpatialLayer      = errors.New("DependencyDescriptorReader: invalid spatial layer, should be less than the number of resolutions")
	ErrDDReaderNumDTIMismatch           = errors.New("DependencyDescriptorReader: decode target indications length mismatch with structure num decode targets")
	ErrDDReaderNumChainDiffsMismatch    = errors.New("DependencyDescriptorReader: chain diffs length mismatch with structure num chains")
)

Functions

func SizeNonSymmetricBits

func SizeNonSymmetricBits(val, numValues uint32) int

Types

type BitStreamReader

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

func NewBitStreamReader

func NewBitStreamReader(buf []byte) *BitStreamReader

func (*BitStreamReader) BytesRead

func (b *BitStreamReader) BytesRead() int

func (*BitStreamReader) Invalidate

func (b *BitStreamReader) Invalidate()

func (*BitStreamReader) Ok

func (b *BitStreamReader) Ok() bool

func (*BitStreamReader) ReadBits

func (b *BitStreamReader) ReadBits(bits int) (uint64, error)

Reads `bits` from the bitstream. `bits` must be in range [0, 64]. Returns an unsigned integer in range [0, 2^bits - 1]. On failure sets `BitstreamReader` into the failure state and returns 0.

func (*BitStreamReader) ReadBool

func (b *BitStreamReader) ReadBool() (bool, error)

func (*BitStreamReader) ReadNonSymmetric

func (b *BitStreamReader) ReadNonSymmetric(numValues uint32) (uint32, error)

Reads value in range [0, `num_values` - 1]. This encoding is similar to ReadBits(val, Ceil(Log2(num_values)), but reduces wastage incurred when encoding non-power of two value ranges Non symmetric values are encoded as: 1) n = bit_width(num_values) 2) k = (1 << n) - num_values Value v in range [0, k - 1] is encoded in (n-1) bits. Value v in range [k, num_values - 1] is encoded as (v+k) in n bits. https://aomediacodec.github.io/av1-spec/#nsn

func (*BitStreamReader) RemainingBits

func (b *BitStreamReader) RemainingBits() int

type BitStreamWriter

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

func NewBitStreamWriter

func NewBitStreamWriter(buf []byte) *BitStreamWriter

func (*BitStreamWriter) RemainingBits

func (w *BitStreamWriter) RemainingBits() int

func (*BitStreamWriter) WriteBits

func (w *BitStreamWriter) WriteBits(val uint64, bitCount int) error

func (*BitStreamWriter) WriteNonSymmetric

func (w *BitStreamWriter) WriteNonSymmetric(val, numValues uint32) error

type DecodeTargetIndication

type DecodeTargetIndication int

Relationship of a frame to a Decode target.

const (
	DecodeTargetNotPresent  DecodeTargetIndication = iota // DecodeTargetInfo symbol '-'
	DecodeTargetDiscardable                               // DecodeTargetInfo symbol 'D'
	DecodeTargetSwitch                                    // DecodeTargetInfo symbol 'S'
	DecodeTargetRequired                                  // DecodeTargetInfo symbol 'R'
)

func (DecodeTargetIndication) String

func (i DecodeTargetIndication) String() string

type DependencyDescriptor

type DependencyDescriptor struct {
	FirstPacketInFrame         bool
	LastPacketInFrame          bool
	FrameNumber                uint16
	FrameDependencies          *FrameDependencyTemplate
	Resolution                 *RenderResolution
	ActiveDecodeTargetsBitmask *uint32
	AttachedStructure          *FrameDependencyStructure
}

func (*DependencyDescriptor) MarshalSize

func (d *DependencyDescriptor) MarshalSize() (int, error)

func (*DependencyDescriptor) MarshalSizeWithActiveChains

func (d *DependencyDescriptor) MarshalSizeWithActiveChains(activeChains uint32) (int, error)

func (*DependencyDescriptor) String

func (d *DependencyDescriptor) String() string

type DependencyDescriptorExtension

type DependencyDescriptorExtension struct {
	Descriptor *DependencyDescriptor
	Structure  *FrameDependencyStructure
}

func (*DependencyDescriptorExtension) Marshal

func (d *DependencyDescriptorExtension) Marshal() ([]byte, error)

func (*DependencyDescriptorExtension) MarshalWithActiveChains

func (d *DependencyDescriptorExtension) MarshalWithActiveChains(activeChains uint32) ([]byte, error)

func (*DependencyDescriptorExtension) Unmarshal

func (d *DependencyDescriptorExtension) Unmarshal(buf []byte) (int, error)

type DependencyDescriptorReader

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

func NewDependencyDescriptorReader

func NewDependencyDescriptorReader(buf []byte, structure *FrameDependencyStructure, descriptor *DependencyDescriptor) *DependencyDescriptorReader

func (*DependencyDescriptorReader) Parse

func (r *DependencyDescriptorReader) Parse() (int, error)

type DependencyDescriptorWriter

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

func NewDependencyDescriptorWriter

func NewDependencyDescriptorWriter(buf []byte, structure *FrameDependencyStructure, activeChains uint32, descriptor *DependencyDescriptor) (*DependencyDescriptorWriter, error)

func (*DependencyDescriptorWriter) ResetBuf

func (w *DependencyDescriptorWriter) ResetBuf(buf []byte)

func (*DependencyDescriptorWriter) ValueSizeBits

func (w *DependencyDescriptorWriter) ValueSizeBits() int

func (*DependencyDescriptorWriter) Write

func (w *DependencyDescriptorWriter) Write() error

type FrameDependencyStructure

type FrameDependencyStructure struct {
	StructureId      int
	NumDecodeTargets int
	NumChains        int
	// If chains are used (num_chains > 0), maps decode target index into index of
	// the chain protecting that target.
	DecodeTargetProtectedByChain []int
	Resolutions                  []RenderResolution
	Templates                    []*FrameDependencyTemplate
}

func (*FrameDependencyStructure) String

func (f *FrameDependencyStructure) String() string

type FrameDependencyTemplate

type FrameDependencyTemplate struct {
	SpatialId               int
	TemporalId              int
	DecodeTargetIndications []DecodeTargetIndication
	FrameDiffs              []int
	ChainDiffs              []int
}

func (*FrameDependencyTemplate) Clone

type RenderResolution

type RenderResolution struct {
	Width  int
	Height int
}

type TemplateMatch

type TemplateMatch struct {
	TemplateIdx      int
	NeedCustomDtis   bool
	NeedCustomFdiffs bool
	NeedCustomChains bool
	// Size in bits to store frame-specific details, i.e.
	// excluding mandatory fields and template dependency structure.
	ExtraSizeBits int
}

Jump to

Keyboard shortcuts

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