h265

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: 5 Imported by: 70

Documentation

Overview

Package h265 contains utilities to work with the H265 codec.

Index

Constants

View Source
const (
	// MaxAccessUnitSize is the maximum size of an access unit.
	// With a 50 Mbps 2160p60 H265 video, the maximum size does not seem to exceed 8 MiB.
	MaxAccessUnitSize = 8 * 1024 * 1024

	// MaxNALUsPerAccessUnit is the maximum number of NALUs per access unit.
	MaxNALUsPerAccessUnit = 21
)

Variables

This section is empty.

Functions

func IsRandomAccess added in v1.0.0

func IsRandomAccess(au [][]byte) bool

IsRandomAccess checks whether the access unit is a random access point.

Types

type DTSExtractor deprecated

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

DTSExtractor computes DTS from PTS.

Deprecated: replaced by DTSExtractor2.

func NewDTSExtractor deprecated

func NewDTSExtractor() *DTSExtractor

NewDTSExtractor allocates a DTSExtractor.

Deprecated: replaced by NewDTSExtractor2.

func (*DTSExtractor) Extract

func (d *DTSExtractor) Extract(au [][]byte, pts time.Duration) (time.Duration, error)

Extract extracts the DTS of a access unit.

type DTSExtractor2 added in v1.13.0

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

DTSExtractor2 computes DTS from PTS.

func NewDTSExtractor2 added in v1.13.0

func NewDTSExtractor2() *DTSExtractor2

NewDTSExtractor2 allocates a DTSExtractor.

func (*DTSExtractor2) Extract added in v1.13.0

func (d *DTSExtractor2) Extract(au [][]byte, pts int64) (int64, error)

Extract extracts the DTS of a access unit.

type NALUType

type NALUType uint8

NALUType is the type of a NALU. Specification: ITU-T Rec. H.265, Table 7-1

const (
	NALUType_TRAIL_N        NALUType = 0  //nolint:revive
	NALUType_TRAIL_R        NALUType = 1  //nolint:revive
	NALUType_TSA_N          NALUType = 2  //nolint:revive
	NALUType_TSA_R          NALUType = 3  //nolint:revive
	NALUType_STSA_N         NALUType = 4  //nolint:revive
	NALUType_STSA_R         NALUType = 5  //nolint:revive
	NALUType_RADL_N         NALUType = 6  //nolint:revive
	NALUType_RADL_R         NALUType = 7  //nolint:revive
	NALUType_RASL_N         NALUType = 8  //nolint:revive
	NALUType_RASL_R         NALUType = 9  //nolint:revive
	NALUType_RSV_VCL_N10    NALUType = 10 //nolint:revive
	NALUType_RSV_VCL_N12    NALUType = 12 //nolint:revive
	NALUType_RSV_VCL_N14    NALUType = 14 //nolint:revive
	NALUType_RSV_VCL_R11    NALUType = 11 //nolint:revive
	NALUType_RSV_VCL_R13    NALUType = 13 //nolint:revive
	NALUType_RSV_VCL_R15    NALUType = 15 //nolint:revive
	NALUType_BLA_W_LP       NALUType = 16 //nolint:revive
	NALUType_BLA_W_RADL     NALUType = 17 //nolint:revive
	NALUType_BLA_N_LP       NALUType = 18 //nolint:revive
	NALUType_IDR_W_RADL     NALUType = 19 //nolint:revive
	NALUType_IDR_N_LP       NALUType = 20 //nolint:revive
	NALUType_CRA_NUT        NALUType = 21 //nolint:revive
	NALUType_RSV_IRAP_VCL22 NALUType = 22 //nolint:revive
	NALUType_RSV_IRAP_VCL23 NALUType = 23 //nolint:revive
	NALUType_VPS_NUT        NALUType = 32 //nolint:revive
	NALUType_SPS_NUT        NALUType = 33 //nolint:revive
	NALUType_PPS_NUT        NALUType = 34 //nolint:revive
	NALUType_AUD_NUT        NALUType = 35 //nolint:revive
	NALUType_EOS_NUT        NALUType = 36 //nolint:revive
	NALUType_EOB_NUT        NALUType = 37 //nolint:revive
	NALUType_FD_NUT         NALUType = 38 //nolint:revive
	NALUType_PREFIX_SEI_NUT NALUType = 39 //nolint:revive
	NALUType_SUFFIX_SEI_NUT NALUType = 40 //nolint:revive

	// additional NALU types for RTP/H265
	NALUType_AggregationUnit   NALUType = 48 //nolint:revive
	NALUType_FragmentationUnit NALUType = 49 //nolint:revive
	NALUType_PACI              NALUType = 50 //nolint:revive
)

NALU types.

func (NALUType) String

func (nt NALUType) String() string

String implements fmt.Stringer.

type PPS

type PPS struct {
	ID                                uint32
	SPSID                             uint32
	DependentSliceSegmentsEnabledFlag bool
	OutputFlagPresentFlag             bool
	NumExtraSliceHeaderBits           uint8
}

PPS is a H265 picture parameter set. Specification: ITU-T Rec. H.265, 7.3.2.3.1

func (*PPS) Unmarshal

func (p *PPS) Unmarshal(buf []byte) error

Unmarshal decodes a PPS.

type SPS

type SPS struct {
	VPSID                                uint8
	MaxSubLayersMinus1                   uint8
	TemporalIDNestingFlag                bool
	ProfileTierLevel                     SPS_ProfileTierLevel
	ID                                   uint8
	ChromaFormatIdc                      uint32
	SeparateColourPlaneFlag              bool
	PicWidthInLumaSamples                uint32
	PicHeightInLumaSamples               uint32
	ConformanceWindow                    *SPS_Window
	BitDepthLumaMinus8                   uint32
	BitDepthChromaMinus8                 uint32
	Log2MaxPicOrderCntLsbMinus4          uint32
	SubLayerOrderingInfoPresentFlag      bool
	MaxDecPicBufferingMinus1             []uint32
	MaxNumReorderPics                    []uint32
	MaxLatencyIncreasePlus1              []uint32
	Log2MinLumaCodingBlockSizeMinus3     uint32
	Log2DiffMaxMinLumaCodingBlockSize    uint32
	Log2MinLumaTransformBlockSizeMinus2  uint32
	Log2DiffMaxMinLumaTransformBlockSize uint32
	MaxTransformHierarchyDepthInter      uint32
	MaxTransformHierarchyDepthIntra      uint32
	ScalingListEnabledFlag               bool
	ScalingListData                      *SPS_ScalingListData
	AmpEnabledFlag                       bool
	SampleAdaptiveOffsetEnabledFlag      bool
	PcmEnabledFlag                       bool

	// PcmEnabledFlag == true
	PcmSampleBitDepthLumaMinus1          uint8
	PcmSampleBitDepthChromaMinus1        uint8
	Log2MinPcmLumaCodingBlockSizeMinus3  uint32
	Log2DiffMaxMinPcmLumaCodingBlockSize uint32
	PcmLoopFilterDisabledFlag            bool

	ShortTermRefPicSets             []*SPS_ShortTermRefPicSet
	LongTermRefPicsPresentFlag      bool
	TemporalMvpEnabledFlag          bool
	StrongIntraSmoothingEnabledFlag bool
	VUI                             *SPS_VUI
}

SPS is a H265 sequence parameter set. Specification: ITU-T Rec. H.265, 7.3.2.2.1

func (SPS) FPS

func (s SPS) FPS() float64

FPS returns the frames per second of the video.

func (SPS) Height

func (s SPS) Height() int

Height returns the video height.

func (*SPS) Unmarshal

func (s *SPS) Unmarshal(buf []byte) error

Unmarshal decodes a SPS from bytes.

func (SPS) Width

func (s SPS) Width() int

Width returns the video width.

type SPS_ConformanceWindow deprecated

type SPS_ConformanceWindow = SPS_Window //nolint:revive

SPS_ConformanceWindow is a conformance window of a SPS.

Deprecated: replaced by SPS_Window

type SPS_DefaultDisplayWindow deprecated

type SPS_DefaultDisplayWindow = SPS_Window //nolint:revive

SPS_DefaultDisplayWindow is a default display window.

Deprecated: replaced by SPS_Window

type SPS_ProfileTierLevel

type SPS_ProfileTierLevel struct {
	GeneralProfileSpace                 uint8
	GeneralTierFlag                     uint8
	GeneralProfileIdc                   uint8
	GeneralProfileCompatibilityFlag     [32]bool
	GeneralProgressiveSourceFlag        bool
	GeneralInterlacedSourceFlag         bool
	GeneralNonPackedConstraintFlag      bool
	GeneralFrameOnlyConstraintFlag      bool
	GeneralMax12bitConstraintFlag       bool
	GeneralMax10bitConstraintFlag       bool
	GeneralMax8bitConstraintFlag        bool
	GeneralMax422ChromeConstraintFlag   bool
	GeneralMax420ChromaConstraintFlag   bool
	GeneralMaxMonochromeConstraintFlag  bool
	GeneralIntraConstraintFlag          bool
	GeneralOnePictureOnlyConstraintFlag bool
	GeneralLowerBitRateConstraintFlag   bool
	GeneralMax14BitConstraintFlag       bool
	GeneralLevelIdc                     uint8
	SubLayerProfilePresentFlag          []bool
	SubLayerLevelPresentFlag            []bool
}

SPS_ProfileTierLevel is a profile level tier of a SPS.

type SPS_ScalingListData added in v1.12.0

type SPS_ScalingListData struct {
	ScalingListPredModeFlag      [4][6]bool
	ScalingListPredmatrixIDDelta [4][6]uint32
	ScalingListDcCoefMinus8      [4][6]int32
}

SPS_ScalingListData is a scaling list data.

type SPS_ShortTermRefPicSet

type SPS_ShortTermRefPicSet struct {
	InterRefPicSetPredictionFlag bool
	DeltaIdxMinus1               uint32
	DeltaRpsSign                 bool
	AbsDeltaRpsMinus1            uint32
	NumNegativePics              uint32
	NumPositivePics              uint32
	DeltaPocS0                   []int32
	UsedByCurrPicS0Flag          []bool
	DeltaPocS1                   []int32
	UsedByCurrPicS1Flag          []bool
}

SPS_ShortTermRefPicSet is a short-term reference picture set.

type SPS_TimingInfo

type SPS_TimingInfo struct {
	NumUnitsInTick              uint32
	TimeScale                   uint32
	POCProportionalToTimingFlag bool

	// POCProportionalToTimingFlag == true
	NumTicksPOCDiffOneMinus1 uint32
}

SPS_TimingInfo is a timing info.

type SPS_VUI

type SPS_VUI struct {
	AspectRatioInfoPresentFlag bool

	// AspectRatioInfoPresentFlag == true
	AspectRatioIdc uint8
	SarWidth       uint16
	SarHeight      uint16

	OverscanInfoPresentFlag bool

	// OverscanInfoPresentFlag == true
	OverscanAppropriateFlag    bool
	VideoSignalTypePresentFlag bool

	// VideoSignalTypePresentFlag == true
	VideoFormat                  uint8
	VideoFullRangeFlag           bool
	ColourDescriptionPresentFlag bool

	// ColourDescriptionPresentFlag == true
	ColourPrimaries         uint8
	TransferCharacteristics uint8
	MatrixCoefficients      uint8

	ChromaLocInfoPresentFlag bool

	// ChromaLocInfoPresentFlag == true
	ChromaSampleLocTypeTopField    uint32
	ChromaSampleLocTypeBottomField uint32

	NeutralChromaIndicationFlag bool
	FieldSeqFlag                bool
	FrameFieldInfoPresentFlag   bool
	DefaultDisplayWindow        *SPS_Window
	TimingInfo                  *SPS_TimingInfo
}

SPS_VUI is a video usability information.

type SPS_Window added in v1.13.1

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

SPS_Window is a window.

Jump to

Keyboard shortcuts

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