av1

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 2 Imported by: 35

Documentation

Overview

Package av1 contains utilities to work with the AV1 codec.

Index

Constants

View Source
const (
	// MaxTemporalUnitSize is the maximum size of a temporal unit.
	MaxTemporalUnitSize = 3 * 1024 * 1024

	// MaxOBUsPerTemporalUnit is the maximum number of OBUs per temporal unit.
	MaxOBUsPerTemporalUnit = 10
)

Variables

This section is empty.

Functions

func BitstreamMarshal added in v1.0.0

func BitstreamMarshal(tu [][]byte) ([]byte, error)

BitstreamMarshal encodes a temporal unit into a bitstream. Specification: https://aomediacodec.github.io/av1-spec/#low-overhead-bitstream-format

func BitstreamUnmarshal

func BitstreamUnmarshal(bs []byte, removeSizeField bool) ([][]byte, error)

BitstreamUnmarshal extracts a temporal unit from a bitstream. Optionally, it also removes the size field from OBUs. Specification: https://aomediacodec.github.io/av1-spec/#low-overhead-bitstream-format

func ContainsKeyFrame

func ContainsKeyFrame(tu [][]byte) (bool, error)

ContainsKeyFrame checks whether a temporal unit contain a key frame.

func LEB128MarshalSize added in v1.0.0

func LEB128MarshalSize(v uint) int

LEB128MarshalSize returns the marshal size of an unsigned integer in LEB128 format. Specification: https://aomediacodec.github.io/av1-spec/#leb128

func LEB128MarshalTo added in v1.0.0

func LEB128MarshalTo(v uint, buf []byte) int

LEB128MarshalTo encodes an unsigned integer with the LEB128 format. Specification: https://aomediacodec.github.io/av1-spec/#leb128

func LEB128Unmarshal

func LEB128Unmarshal(buf []byte) (uint, int, error)

LEB128Unmarshal decodes an unsigned integer from the LEB128 format. Specification: https://aomediacodec.github.io/av1-spec/#leb128

Types

type OBUHeader

type OBUHeader struct {
	Type    OBUType
	HasSize bool
}

OBUHeader is a OBU header. Specification: https://aomediacodec.github.io/av1-spec/#obu-header-syntax

func (*OBUHeader) Unmarshal

func (h *OBUHeader) Unmarshal(buf []byte) error

Unmarshal decodes a OBUHeader.

type OBUType

type OBUType uint8

OBUType is an OBU type.

const (
	OBUTypeSequenceHeader OBUType = 1
)

OBU types.

type SequenceHeader added in v1.0.0

type SequenceHeader struct {
	SeqProfile                     uint8
	StillPicture                   bool
	ReducedStillPictureHeader      bool
	TimingInfoPresentFlag          bool
	DecoderModelInfoPresentFlag    bool
	InitialDisplayDelayPresentFlag bool
	OperatingPointsCntMinus1       uint8
	OperatingPointIdc              []uint16
	SeqLevelIdx                    []uint8
	SeqTier                        []bool
	DecoderModelPresentForThisOp   []bool
	InitialDisplayPresentForThisOp []bool
	InitialDisplayDelayMinus1      []uint8
	MaxFrameWidthMinus1            uint32
	MaxFrameHeightMinus1           uint32
	FrameIDNumbersPresentFlag      bool
	Use128x128Superblock           bool
	EnableFilterIntra              bool
	EnableIntraEdgeFilter          bool
	EnableInterintraCompound       bool
	EnableMaskedCompound           bool
	EnableWarpedMotion             bool
	EnableDualFilter               bool
	EnableOrderHint                bool
	EnableJntComp                  bool
	EnableRefFrameMvs              bool
	SeqChooseScreenContentTools    bool
	SeqForceScreenContentTools     SequenceHeader_SeqForceScreenContentTools
	SeqChooseIntegerMv             bool
	SeqForceIntegerMv              SequenceHeader_SeqForceIntegerMv
	OrderHintBitsMinus1            uint8
	EnableSuperRes                 bool
	EnableCdef                     bool
	EnableRestoration              bool
	ColorConfig                    SequenceHeader_ColorConfig
}

SequenceHeader is a AV1 Sequence header OBU. Specification: https://aomediacodec.github.io/av1-spec/#sequence-header-obu-syntax

func (SequenceHeader) Height added in v1.0.0

func (h SequenceHeader) Height() int

Height returns the video height.

func (*SequenceHeader) Unmarshal added in v1.0.0

func (h *SequenceHeader) Unmarshal(buf []byte) error

Unmarshal decodes a SequenceHeader.

func (SequenceHeader) Width added in v1.0.0

func (h SequenceHeader) Width() int

Width returns the video width.

type SequenceHeader_ChromaSamplePosition added in v1.0.0

type SequenceHeader_ChromaSamplePosition uint8 //nolint:revive

SequenceHeader_ChromaSamplePosition is a ChromaSamplePosition value.

const (
	SequenceHeader_ChromaSamplePosition_CSP_UNKNOWN SequenceHeader_ChromaSamplePosition = 0 //nolint:revive
)

type SequenceHeader_ColorConfig added in v1.0.0

type SequenceHeader_ColorConfig struct {
	HighBitDepth                bool
	TwelveBit                   bool
	BitDepth                    int
	MonoChrome                  bool
	ColorDescriptionPresentFlag bool
	ColorPrimaries              SequenceHeader_ColorPrimaries
	TransferCharacteristics     SequenceHeader_TransferCharacteristics
	MatrixCoefficients          SequenceHeader_MatrixCoefficients
	ColorRange                  bool
	SubsamplingX                bool
	SubsamplingY                bool
	ChromaSamplePosition        SequenceHeader_ChromaSamplePosition
}

SequenceHeader_ColorConfig is a color configuration of a sequence header.

type SequenceHeader_ColorPrimaries added in v1.0.0

type SequenceHeader_ColorPrimaries uint8 //nolint:revive

SequenceHeader_ColorPrimaries is a ColorPrimaries value.

const (
	SequenceHeader_ColorPrimaries_CP_BT_709      SequenceHeader_ColorPrimaries = 1 //nolint:revive
	SequenceHeader_ColorPrimaries_CP_UNSPECIFIED SequenceHeader_ColorPrimaries = 2 //nolint:revive
)

type SequenceHeader_MatrixCoefficients added in v1.0.0

type SequenceHeader_MatrixCoefficients uint8 //nolint:revive

SequenceHeader_MatrixCoefficients is a MatrixCoefficients value.

const (
	SequenceHeader_MatrixCoefficients_MC_IDENTITY    SequenceHeader_MatrixCoefficients = 0 //nolint:revive
	SequenceHeader_MatrixCoefficients_MC_UNSPECIFIED SequenceHeader_MatrixCoefficients = 2 //nolint:revive
)

type SequenceHeader_SeqForceIntegerMv added in v1.0.0

type SequenceHeader_SeqForceIntegerMv uint8 //nolint:revive

SequenceHeader_SeqForceIntegerMv is a SeqForceIntegerMv value.

const (
	SequenceHeader_SeqForceIntegerMv_SELECT_INTEGER_MV SequenceHeader_SeqForceIntegerMv = 2 //nolint:revive
)

type SequenceHeader_SeqForceScreenContentTools added in v1.0.0

type SequenceHeader_SeqForceScreenContentTools uint8 //nolint:revive

SequenceHeader_SeqForceScreenContentTools is a SeqForceScreenContentTools value.

const (
	SequenceHeader_SeqForceScreenContentTools_SELECT_SCREEN_CONTENT_TOOLS SequenceHeader_SeqForceScreenContentTools = 2 //nolint:revive,lll
)

type SequenceHeader_TransferCharacteristics added in v1.0.0

type SequenceHeader_TransferCharacteristics uint8 //nolint:revive

SequenceHeader_TransferCharacteristics is a TransferCharacteristics value.

const (
	SequenceHeader_TransferCharacteristics_TC_UNSPECIFIED SequenceHeader_TransferCharacteristics = 2  //nolint:revive
	SequenceHeader_TransferCharacteristics_TC_SRGB        SequenceHeader_TransferCharacteristics = 13 //nolint:revive
)

Jump to

Keyboard shortcuts

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