hevc

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package hevc - parsing of HEVC(H.265) NAL unit headers, slice headers, VPS, SPS, and PPS.

Index

Constants

View Source
const (
	NALU_TRAIL_N = NaluType(0)
	NALU_TRAIL_R = NaluType(1)
	NALU_TSA_N   = NaluType(2)
	NALU_TSA_R   = NaluType(3)
	NALU_STSA_N  = NaluType(4)
	NALU_STSA_R  = NaluType(5)
	NALU_RADL_N  = NaluType(6)
	NALU_RADL_R  = NaluType(7)
	NALU_RASL_N  = NaluType(8)
	NALU_RASL_R  = NaluType(9)
	// BLA_W_LP and the following types are Random Access
	NALU_BLA_W_LP   = NaluType(16)
	NALU_BLA_W_RADL = NaluType(17)
	NALU_BLA_N_LP   = NaluType(18)
	NALU_IDR_W_RADL = NaluType(19)
	NALU_IDR_N_LP   = NaluType(20)
	NALU_CRA        = NaluType(21)
	// Reserved IRAP VCL NAL unit types
	NALU_IRAP_VCL22 = NaluType(22)
	NALU_IRAP_VCL23 = NaluType(23)
	// NALU_VPS - VideoParameterSet NAL Unit
	NALU_VPS = NaluType(32)
	// NALU_SPS - SequenceParameterSet NAL Unit
	NALU_SPS = NaluType(33)
	// NALU_PPS - PictureParameterSet NAL Unit
	NALU_PPS = NaluType(34)
	// NALU_AUD - AccessUnitDelimiter NAL Unit
	NALU_AUD = NaluType(35)
	//NALU_EOS - End of Sequence NAL Unit
	NALU_EOS = NaluType(36)
	//NALU_EOB - End of Bitstream NAL Unit
	NALU_EOB = NaluType(37)
	//NALU_FD - Filler data NAL Unit
	NALU_FD = NaluType(38)
	//NALU_SEI_PREFIX - Prefix SEI NAL Unit
	NALU_SEI_PREFIX = NaluType(39)
	//NALU_SEI_SUFFIX - Suffix SEI NAL Unit
	NALU_SEI_SUFFIX = NaluType(40)
)

HEVC NALU types

View Source
const (
	SLICE_B = SliceType(0)
	SLICE_P = SliceType(1)
	SLICE_I = SliceType(2)
)

HEVC slice types

Variables

View Source
var (
	ErrLengthSize = errors.New("can only handle 4byte NALU length size")
)

HEVC errors

View Source
var (
	ErrNotPPS = errors.New("not an PPS NAL unit")
)

HEVC PPS errors

View Source
var (
	ErrNotSEINalu = errors.New("not an SEI NAL unit")
)

Functions

func CodecString

func CodecString(sampleEntry string, sps *SPS) string

CodecString - sub-parameter for MIME type "codecs" parameter like hev1.1.6.L93.B0 where hev1 is sampleEntry. Defined in ISO/IEC 14496-15 2017 Annex E.

func ContainsNaluType

func ContainsNaluType(sample []byte, specificNaluType NaluType) bool

ContainsNaluType - is specific NaluType present in sample

func ExtractNalusOfTypeFromByteStream

func ExtractNalusOfTypeFromByteStream(nType NaluType, data []byte, stopAtVideo bool) [][]byte

ExtractNalusOfTypeFromByteStream returns all HEVC nalus of wanted type from bytestream. If stopAtVideo, the stream is not scanned beyond the first video NAL unit.

func GetParameterSets

func GetParameterSets(sample []byte) (vps, sps, pps [][]byte)

GetParameterSets - get (multiple) VPS, SPS, and PPS from a sample

func GetParameterSetsFromByteStream

func GetParameterSetsFromByteStream(data []byte) (vpss [][]byte, spss [][]byte, ppss [][]byte)

GetParameterSetsFromByteStream gets SPS and PPS nalus from bytestream

func HasParameterSets

func HasParameterSets(b []byte) bool

HasParameterSets - Check if HEVC VPS, SPS and PPS are present

func IsIDRSample

func IsIDRSample(sample []byte) bool

IsIDRSample - is IDR picture (NALU 19-20)

func IsRAPSample

func IsRAPSample(sample []byte) bool

IsRAPSample - is Random Access picture (NALU 16-23)

func ParseSEINalu added in v0.42.0

func ParseSEINalu(nalu []byte, sps *SPS) ([]sei.SEIMessage, error)

ParseSEINalu - parse SEI NAL unit (incl header) and return messages given SPS. Returns sei.ErrRbspTrailingBitsMissing if the NALU is missing the trailing bits.

Types

type BitstreamRestrictions

type BitstreamRestrictions struct {
	TilesFixedStructureFlag     bool
	MVOverPicBoundariesFlag     bool
	RestrictedRefsPicsListsFlag bool
	MinSpatialSegmentationIDC   uint
	MaxBytesPerPicDenom         uint
	MaxBitsPerMinCuDenom        uint
	Log2MaxMvLengthHorizontal   uint
	Log2MaxMvLengthVertical     uint
}

BitstreamRestrictrictions - optional information

type ColourMappingTable added in v0.35.0

type ColourMappingTable struct {
	NumCmRefLayersMinus1         uint8
	RefLayerId                   []uint8
	OctantDepth                  uint8
	YPartNumLog2                 uint8
	LumaBitDepthCmInputMinus8    uint
	ChromaBitDepthCmInputMinus8  uint
	LumaBitDepthCmOutputMinus8   uint
	ChromaBitDepthCmOutputMinus8 uint
	ResQuantBits                 uint8
	DeltaFlcBitsMinus1           uint8
	AdaptThresholdUDelta         int
	AdaptThresholdVDelta         int
	Octants                      map[string][4]Octant
}

type ConformanceWindow

type ConformanceWindow struct {
	LeftOffset   uint32
	RightOffset  uint32
	TopOffset    uint32
	BottomOffset uint32
}

ConformanceWindow according to ISO/IEC 23008-2

type D3Extension added in v0.35.0

type D3Extension struct {
	DltsPresentFlag              bool
	NumDepthLayersMinus1         uint8
	BitDepthForDepthLayersMinus8 uint8
	DepthLayers                  []DepthLayer
}

D3Extension represent PPS 3D extension

type DecConfRec

type DecConfRec struct {
	ConfigurationVersion             byte
	GeneralProfileSpace              byte
	GeneralTierFlag                  bool
	GeneralProfileIDC                byte
	GeneralProfileCompatibilityFlags uint32
	GeneralConstraintIndicatorFlags  uint64
	GeneralLevelIDC                  byte
	MinSpatialSegmentationIDC        uint16
	ParallellismType                 byte
	ChromaFormatIDC                  byte
	BitDepthLumaMinus8               byte
	BitDepthChromaMinus8             byte
	AvgFrameRate                     uint16
	ConstantFrameRate                byte
	NumTemporalLayers                byte
	TemporalIDNested                 byte
	LengthSizeMinusOne               byte
	NaluArrays                       []NaluArray
}

DecConfRec - HEVCDecoderConfigurationRecord Specified in ISO/IEC 14496-15 4't ed 2017 Sec. 8.3.3

func CreateHEVCDecConfRec

func CreateHEVCDecConfRec(vpsNalus, spsNalus, ppsNalus [][]byte,
	vpsComplete, spsComplete, ppsComplete, includePS bool) (DecConfRec, error)

CreateHEVCDecConfRec - extract information from sps and insert vps, sps, pps if includePS set

func DecodeHEVCDecConfRec

func DecodeHEVCDecConfRec(data []byte) (DecConfRec, error)

DecodeHEVCDecConfRec - decode an HEVCDecConfRec

func (*DecConfRec) AddNaluArrays

func (h *DecConfRec) AddNaluArrays(na []NaluArray)

AddNaluArrays appends new nalus to HEVCDecConfRec.

func (*DecConfRec) Encode

func (h *DecConfRec) Encode(w io.Writer) error

func (*DecConfRec) EncodeSW

func (h *DecConfRec) EncodeSW(sw bits.SliceWriter) error

EncodeSW- write an HEVCDecConfRec to sw

func (*DecConfRec) GetNalusForType

func (h *DecConfRec) GetNalusForType(naluType NaluType) [][]byte

GetNalusForType - get all nalus for a specific naluType

func (*DecConfRec) Size

func (h *DecConfRec) Size() uint64

Size - total size in bytes

type DeltaDlt added in v0.35.0

type DeltaDlt struct {
	NumValDeltaDlt       uint
	MaxDiff              uint
	MinDiffMinus1        uint
	DeltaDltVal0         uint
	DeltaValDiffMinusMin []uint
}

type DepthLayer added in v0.35.0

type DepthLayer struct {
	DltFlag                bool
	DltPredFlag            bool
	DltValFlagsPresentFlag bool
	DltValueFlag           []bool
	DeltaDlt               *DeltaDlt
}

type HrdParameters added in v0.36.0

type HrdParameters struct {
	NalHrdParametersPresentFlag            bool
	VclHrdParametersPresentFlag            bool
	SubPicHrdParamsPresentFlag             bool
	TickDivisorMinus2                      uint8
	DuCpbRemovalDelayIncrementLengthMinus1 uint8
	SubPicCpbParamsInPicTimingSeiFlag      bool
	DpbOutputDelayDuLengthMinus1           uint8
	BitRateScale                           uint8
	CpbSizeScale                           uint8
	CpbSizeDuScale                         uint8
	InitialCpbRemovalDelayLengthMinus1     uint8
	AuCpbRemovalDelayLengthMinus1          uint8
	DpbOutputDelayLengthMinus1             uint8
	SubLayerHrd                            []SubLayerHrd
}

func (*HrdParameters) CpbDpbDelaysPresentFlag added in v0.42.0

func (h *HrdParameters) CpbDpbDelaysPresentFlag() bool

CpbDpbDelaysPresentFlag is defined in ISO/IEC 23008-2 Section E.3.2.

type LongTermRPS added in v0.35.0

type LongTermRPS struct {
	PocLsbLt               uint16
	UsedByCurrPicLtFlag    bool
	DeltaPocMsbPresentFlag bool
	DeltaPocMsbCycleLt     uint
}

type MultilayerExtension added in v0.35.0

type MultilayerExtension struct {
	PocResetInfoPresentFlag  bool
	InferScalingListFlag     bool
	ScalingListRefLayerId    uint8
	NumRefLocOffsets         uint
	RefLocOffsetLayerIds     []uint8
	RefLocOffsets            map[uint8]RefLocOffset
	ColourMappingEnabledFlag bool
	ColourMappingTable       *ColourMappingTable
}

type NaluArray

type NaluArray struct {
	Nalus [][]byte
	// contains filtered or unexported fields
}

NaluArray - HEVC NALU array including complete bit and type

func NewNaluArray

func NewNaluArray(complete bool, naluType NaluType, nalus [][]byte) NaluArray

NewNaluArray - create an HEVC NaluArray

func (*NaluArray) Complete

func (n *NaluArray) Complete() byte

Complete - return 0x1 if complete

func (*NaluArray) NaluType

func (n *NaluArray) NaluType() NaluType

NaluType - return NaluType for NaluArray

type NaluType

type NaluType uint16

NaluType - HEVC nal type according to ISO/IEC 23008-2 Table 7.1

func FindNaluTypes

func FindNaluTypes(sample []byte) []NaluType

FindNaluTypes - find list of nalu types in sample

func FindNaluTypesUpToFirstVideoNalu

func FindNaluTypesUpToFirstVideoNalu(sample []byte) []NaluType

FindNaluTypesUpToFirstVideoNalu - all nalu types up to first video nalu

func GetNaluType

func GetNaluType(naluHeaderStart byte) NaluType

GetNaluType - extract NALU type from first byte of NALU Header

func (NaluType) String

func (n NaluType) String() string

type Octant added in v0.35.0

type Octant struct {
	CodedResFlag bool
	CodedRes     [3]struct {
		ResCoeffQ uint
		ResCoeffR uint
		ResCoeffS bool
	}
}

type PPS added in v0.35.0

type PPS struct {
	PicParameterSetID                      uint32
	SeqParameterSetID                      uint32
	DependentSliceSegmentsEnabledFlag      bool
	OutputFlagPresentFlag                  bool
	NumExtraSliceHeaderBits                uint8
	SignDataHidingEnabledFlag              bool
	CabacInitPresentFlag                   bool
	NumRefIdxL0DefaultActiveMinus1         uint8
	NumRefIdxL1DefaultActiveMinus1         uint8
	InitQpMinus26                          int8
	ConstrainedIntraPredFlag               bool
	TransformSkipEnabledFlag               bool
	CuQpDeltaEnabledFlag                   bool
	DiffCuQpDeltaDepth                     uint
	CbQpOffset                             int8
	CrQpOffset                             int8
	SliceChromaQpOffsetsPresentFlag        bool
	WeightedPredFlag                       bool
	WeightedBipredFlag                     bool
	TransquantBypassEnabledFlag            bool
	TilesEnabledFlag                       bool
	EntropyCodingSyncEnabledFlag           bool
	NumTileColumnsMinus1                   uint
	NumTileRowsMinus1                      uint
	UniformSpacingFlag                     bool
	ColumnWidthMinus1                      []uint
	RowHeightMinus1                        []uint
	LoopFilterAcrossTilesEnabledFlag       bool
	LoopFilterAcrossSlicesEnabledFlag      bool
	DeblockingFilterControlPresentFlag     bool
	DeblockingFilterOverrideEnabledFlag    bool
	DeblockingFilterDisabledFlag           bool
	BetaOffsetDiv2                         int8
	TcOffsetDiv2                           int8
	ScalingListDataPresentFlag             bool
	ListsModificationPresentFlag           bool
	Log2ParallelMergeLevelMinus2           uint
	SliceSegmentHeaderExtensionPresentFlag bool
	ExtensionPresentFlag                   bool
	RangeExtensionFlag                     bool
	RangeExtension                         *RangeExtension
	MultilayerExtensionFlag                bool
	MultilayerExtension                    *MultilayerExtension
	// PPS 3D extension
	D3ExtensionFlag   bool
	D3Extension       *D3Extension
	SccExtensionFlag  bool
	SccExtension      *SccExtension
	Extension4bits    uint8
	ExtensionDataFlag []bool
}

PPS - Picture Parameter Set

func ParsePPSNALUnit added in v0.35.0

func ParsePPSNALUnit(data []byte, spsMap map[uint32]*SPS) (*PPS, error)

ParsePPSNALUnit - Parse AVC PPS NAL unit starting with NAL header

type PredWeightTable added in v0.35.0

type PredWeightTable struct {
	LumaLog2WeightDenom        uint8
	DeltaChromaLog2WeightDenom int8
	WeightsL0                  []WeightingFactors
	WeightsL1                  []WeightingFactors
}

type ProfileTierLevel

type ProfileTierLevel struct {
	GeneralProfileSpace              byte
	GeneralTierFlag                  bool
	GeneralProfileIDC                byte
	GeneralProfileCompatibilityFlags uint32
	GeneralProgressiveSourceFlag     bool
	GeneralInterlacedSourceFlag      bool
	GeneralNonPackedConstraintFlag   bool
	GeneralFrameOnlyConstraintFlag   bool
	// GeneralConstraintIndicatorFlags is 4 + 43+1 bits including the 4 flags above from GeneralProgressiveSourceFlag
	GeneralConstraintIndicatorFlags uint64
	GeneralLevelIDC                 byte
	SubLayers                       []SubLayer
}

ProfileTierLevel according to ISO/IEC 23008-2 Section 7.3.3

type RangeExtension added in v0.35.0

type RangeExtension struct {
	Log2MaxTransformSkipBlockSizeMinus2 uint
	CrossComponentPredictionEnabledFlag bool
	ChromaQpOffsetListEnabledFlag       bool
	DiffCuChromaQpOffsetDepth           uint
	ChromaQpOffsetListLenMinus1         uint
	CbQpOffsetList                      []int8
	CrQpOffsetList                      []int8
	Log2SaoOffsetScaleLuma              uint
	Log2SaoOffsetScaleChroma            uint
}

type RefLocOffset added in v0.35.0

type RefLocOffset struct {
	ScaledRefLayerOffsetPresentFlag bool
	ScaledRefLayerLeftOffset        int16
	ScaledRefLayerTopOffset         int16
	ScaledRefLayerRightOffset       int16
	ScaledRefLayerBottomOffset      int16
	RefRegionOffsetPresentFlag      bool
	RefRegionLeftOffset             int16
	RefRegionTopOffset              int16
	RefRegionRightOffset            int16
	RefRegionBottomOffset           int16
	ResamplePhaseSetPresentFlag     bool
	PhaseHorLuma                    uint8
	PhaseVerLuma                    uint8
	PhaseHorChromaPlus8             uint8
	PhaseVerChromaPlus8             uint8
}

type RefPicListsModification added in v0.35.0

type RefPicListsModification struct {
	RefPicListModificationFlagL0 bool
	ListEntryL0                  []uint8
	RefPicListModificationFlagL1 bool
	ListEntryL1                  []uint8
}

type SPS

type SPS struct {
	VpsID                                byte
	MaxSubLayersMinus1                   byte
	TemporalIDNestingFlag                bool
	ProfileTierLevel                     ProfileTierLevel
	SpsID                                byte
	ChromaFormatIDC                      byte
	SeparateColourPlaneFlag              bool
	ConformanceWindowFlag                bool
	PicWidthInLumaSamples                uint32
	PicHeightInLumaSamples               uint32
	ConformanceWindow                    ConformanceWindow
	BitDepthLumaMinus8                   byte
	BitDepthChromaMinus8                 byte
	Log2MaxPicOrderCntLsbMinus4          byte
	SubLayerOrderingInfoPresentFlag      bool
	SubLayeringOrderingInfos             []SubLayerOrderingInfo
	Log2MinLumaCodingBlockSizeMinus3     byte
	Log2DiffMaxMinLumaCodingBlockSize    byte
	Log2MinLumaTransformBlockSizeMinus2  byte
	Log2DiffMaxMinLumaTransformBlockSize byte
	MaxTransformHierarchyDepthInter      byte
	MaxTransformHierarchyDepthIntra      byte
	ScalingListEnabledFlag               bool
	ScalingListDataPresentFlag           bool
	AmpEnabledFlag                       bool
	SampleAdaptiveOffsetEnabledFlag      bool
	PCMEnabledFlag                       bool
	PcmSampleBitDepthLumaMinus1          byte
	PcmSampleBitDepthChromaMinus1        byte
	Log2MinPcmLumaCodingBlockSize        uint16
	Log2DiffMaxMinPcmLumaCodingBlockSize uint16
	PcmLoopFilterDisabledFlag            bool
	NumShortTermRefPicSets               byte
	ShortTermRefPicSets                  []ShortTermRPS
	LongTermRefPicsPresentFlag           bool
	NumLongTermRefPics                   uint8
	LongTermRefPicSets                   []LongTermRPS
	SpsTemporalMvpEnabledFlag            bool
	StrongIntraSmoothingEnabledFlag      bool
	VUIParametersPresentFlag             bool
	VUI                                  *VUIParameters
	ExtensionPresentFlag                 bool
	Extension4bits                       uint8
	RangeExtensionFlag                   bool
	RangeExtension                       *SPSRangeExtension
	MultilayerExtensionFlag              bool
	MultilayerExtension                  *SPSMultilayerExtension
	// SPS 3D extension
	D3ExtensionFlag   bool
	D3Extension       *SPS3dExtension
	SccExtensionFlag  bool
	SccExtension      *SPSSccExtension
	ExtensionDataFlag []bool
}

SPS - HEVC SPS parameters ISO/IEC 23008-2 Sec. 7.3.2.2

func ParseSPSNALUnit

func ParseSPSNALUnit(data []byte) (*SPS, error)

ParseSPSNALUnit parses SPS NAL unit starting with NAL unit header

func (*SPS) ImageSize

func (s *SPS) ImageSize() (width, height uint32)

ImageSize - calculated width and height using ConformanceWindow

type SPS3dExtension added in v0.35.0

type SPS3dExtension struct {
	IvDiMcEnabledFlag0     bool
	IvMvScalEnabledFlag0   bool
	Og2IvmcSubPbSizeMinus3 uint
	IvResPredEnabledFlag   bool
	DepthRefEnabledFlag    bool
	VspMcEnabledFlag       bool
	DbbpEnabledFlag        bool

	IvDiMcEnabledFlag1          bool
	IvMvScalEnabledFlag1        bool
	TexMcEnabledFlag            bool
	Log2TexmcSubPbSizeMinus3    uint
	IntraContourEnabledFlag     bool
	IntraDcOnlyWedgeEnabledFlag bool
	CqtCuPartPredEnabledFlag    bool
	InterDcOnlyEnabledFlag      bool
	SkipIntraEnabledFlag        bool
}

type SPSMultilayerExtension added in v0.35.0

type SPSMultilayerExtension struct {
	InterViewMvVertConstraintFlag bool
}

type SPSRangeExtension added in v0.35.0

type SPSRangeExtension struct {
	TransformSkipRotationEnabledFlag    bool
	TransformSkipContextEnabledFlag     bool
	ImplicitRdpcmEnabledFlag            bool
	ExplicitRdpcmEnabledFlag            bool
	ExtendedPrecisionProcessingFlag     bool
	IntraSmoothingDisabledFlag          bool
	HighPrecisionOffsetsEnabledFlag     bool
	PersistentRiceAdaptationEnabledFlag bool
	CabacBypassAlignmentEnabledFlag     bool
}

type SPSSccExtension added in v0.35.0

type SPSSccExtension struct {
	CurrPicRefEnabledFlag                   bool
	PaletteModeEnabledFlag                  bool
	PaletteMaxSize                          uint
	DeltaPaletteMaxPredictorSize            uint
	PalettePredictorInitializersPresentFlag bool
	NumPalettePredictorInitializersMinus1   uint
	PalettePredictorInitializer             [][]uint
	MotionVectorResolutionControlIdc        uint8
	IntraBoundaryFilteringDisabledFlag      bool
}

type SccExtension added in v0.35.0

type SccExtension struct {
	CurrPicRefEnabledFlag                      bool
	ResidualAdaptiveColourTransformEnabledFlag bool
	SliceActQpOffsetsPresentFlag               bool
	ActYQpOffsetPlus5                          int
	ActCbQpOffsetPlus5                         int
	ActCrQpOffsetPlus3                         int
	PalettePredictorInitializersPresentFlag    bool
	NumPalettePredictorInitializers            uint
	MonochromePaletteFlag                      bool
	LumaBitDepthEntryMinus8                    uint
	ChromaBitDepthEntryMinus8                  uint
	PalettePredictorInitializer                [][]uint
}

type ShortTermRPS

type ShortTermRPS struct {
	// Delta Picture Order Count
	DeltaPocS0      []uint32
	DeltaPocS1      []uint32
	UsedByCurrPicS0 []bool
	UsedByCurrPicS1 []bool
	NumNegativePics byte
	NumPositivePics byte
	NumDeltaPocs    byte
}

ShortTermRPS - Short term Reference Picture Set

type SliceHeader added in v0.35.0

type SliceHeader struct {
	SliceType                         SliceType
	FirstSliceSegmentInPicFlag        bool
	NoOutputOfPriorPicsFlag           bool
	PicParameterSetId                 uint32
	DependentSliceSegmentFlag         bool
	SegmentAddress                    uint
	PicOutputFlag                     bool
	ColourPlaneId                     uint8
	PicOrderCntLsb                    uint16
	ShortTermRefPicSetSpsFlag         bool
	ShortTermRefPicSet                ShortTermRPS
	ShortTermRefPicSetIdx             byte
	NumLongTermSps                    uint8
	NumLongTermPics                   uint
	LongTermRefPicSets                []LongTermRPS
	TemporalMvpEnabledFlag            bool
	SaoLumaFlag                       bool
	SaoChromaFlag                     bool
	NumRefIdxActiveOverrideFlag       bool
	NumRefIdxL0ActiveMinus1           uint8
	NumRefIdxL1ActiveMinus1           uint8
	RefPicListsModification           *RefPicListsModification
	MvdL1ZeroFlag                     bool
	CabacInitFlag                     bool
	CollocatedFromL0Flag              bool
	CollocatedRefIdx                  uint8
	PredWeightTable                   *PredWeightTable
	FiveMinusMaxNumMergeCand          uint8
	UseIntegerMvFlag                  bool
	QpDelta                           int
	CbQpOffset                        int8
	CrQpOffset                        int8
	ActYQpOffset                      int8
	ActCbQpOffset                     int8
	ActCrQpOffset                     int8
	CuChromaQpOffsetEnabledFlag       bool
	DeblockingFilterOverrideFlag      bool
	DeblockingFilterDisabledFlag      bool
	BetaOffsetDiv2                    int8
	TcOffsetDiv2                      int8
	LoopFilterAcrossSlicesEnabledFlag bool
	NumEntryPointOffsets              uint
	OffsetLenMinus1                   uint8
	EntryPointOffsetMinus1            []uint32
	SegmentHeaderExtensionLength      uint16
	SegmentHeaderExtensionDataByte    []byte
	Size                              uint32
}

func ParseSliceHeader added in v0.35.0

func ParseSliceHeader(nalu []byte, spsMap map[uint32]*SPS, ppsMap map[uint32]*PPS) (*SliceHeader, error)

type SliceType added in v0.35.0

type SliceType uint

SliceType - HEVC slice type

func (SliceType) String added in v0.35.0

func (s SliceType) String() string

type SubLayer added in v0.42.0

type SubLayer struct {
	ProfilePresentFlag        bool
	LevelPresentFlag          bool
	ProfileSpace              byte
	TierFlag                  bool
	ProfileIDC                byte
	ProfileCompatibilityFlags uint32
	ProgressiveSourceFlag     bool
	InterlacedSourceFlag      bool
	NonPackedConstraintFlag   bool
	FrameOnlyConstraintFlag   bool
	ConstraintFlags           uint64 // 43+1 bits
	LayerIDC                  byte
}

type SubLayerHrd added in v0.36.0

type SubLayerHrd struct {
	FixedPicRateGeneralFlag     bool
	FixedPicRateWithinCvsFlag   bool
	ElementalDurationInTcMinus1 uint16
	LowDelayHrdFlag             bool
	CpbCntMinus1                uint8
	NalHrdParameters            []SubLayerHrdParameters
	VclHrdParameters            []SubLayerHrdParameters
}

type SubLayerHrdParameters added in v0.36.0

type SubLayerHrdParameters struct {
	BitRateValueMinus1   uint32
	CpbSizeValueMinus1   uint32
	CpbSizeDuValueMinus1 uint32
	BitRateDuValueMinus1 uint32
	CbrFlag              bool
}

type SubLayerOrderingInfo

type SubLayerOrderingInfo struct {
	MaxDecPicBufferingMinus1 byte
	MaxNumReorderPics        byte
	MaxLatencyIncreasePlus1  byte
}

SubLayerOrderingInfo according to ISO/IEC 23008-2

type VUIParameters

type VUIParameters struct {
	SampleAspectRatioWidth         uint
	SampleAspectRatioHeight        uint
	OverscanInfoPresentFlag        bool
	OverscanAppropriateFlag        bool
	VideoSignalTypePresentFlag     bool
	VideoFormat                    byte
	VideoFullRangeFlag             bool
	ColourDescriptionFlag          bool
	ColourPrimaries                byte
	TransferCharacteristics        byte
	MatrixCoefficients             byte
	ChromaLocInfoPresentFlag       bool
	ChromaSampleLocTypeTopField    uint
	ChromaSampleLocTypeBottomField uint
	NeutralChromaIndicationFlag    bool
	FieldSeqFlag                   bool
	FrameFieldInfoPresentFlag      bool
	DefaultDisplayWindowFlag       bool
	DefDispWinLeftOffset           uint
	DefDispWinRightOffset          uint
	DefDispWinTopOffset            uint
	DefDispWinBottomOffset         uint
	TimingInfoPresentFlag          bool
	NumUnitsInTick                 uint
	TimeScale                      uint
	PocProportionalToTimingFlag    bool
	NumTicksPocDiffOneMinus1       uint
	HrdParametersPresentFlag       bool
	HrdParameters                  *HrdParameters
	BitstreamRestrictionFlag       bool
	BitstreamResctrictions         *BitstreamRestrictions
}

VUIParameters - Visual Usability Information as defined in Section E.2

type WeightingFactors added in v0.35.0

type WeightingFactors struct {
	LumaWeightFlag    bool
	ChromaWeightFlag  bool
	DeltaLumaWeight   int8
	LumaOffset        int
	DeltaChromaWeight [2]int8
	DeltaChromaOffset [2]int
}

WeightingFactors fields described in specification 7.4.7.3 (Weighted prediction parameters semantics)

Jump to

Keyboard shortcuts

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