Documentation
¶
Overview ¶
Package hevc - parsing of HEVC(H.265) NAL unit headers, slice headers, VPS, SPS, and PPS.
Index ¶
- Constants
- Variables
- func CodecString(sampleEntry string, sps *SPS) string
- func ContainsNaluType(sample []byte, specificNaluType NaluType) bool
- func GetParameterSets(sample []byte) (vps, sps, pps [][]byte)
- func HasParameterSets(b []byte) bool
- func IsIDRSample(sample []byte) bool
- func IsRAPSample(sample []byte) bool
- type BitstreamRestrictions
- type ConformanceWindow
- type DecConfRec
- type NaluArray
- type NaluType
- type ProfileTierLevel
- type SPS
- type ShortTermRPS
- type SubLayerOrderingInfo
- type VUIParameters
Constants ¶
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) // 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
Variables ¶
var (
ErrLengthSize = errors.New("can only handle 4byte NALU length size")
)
HEVC errors
Functions ¶
func CodecString ¶
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 ¶
ContainsNaluType - is specific NaluType present in sample
func GetParameterSets ¶
GetParameterSets - get (multiple) VPS, SPS, and PPS from a sample
func HasParameterSets ¶
HasParameterSets - Check if HEVC VPS, SPS and PPS are present
func IsRAPSample ¶
IsRAPSample - is Random Access picture (NALU 16-23)
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 ConformanceWindow ¶
type ConformanceWindow struct {
LeftOffset uint32
RightOffset uint32
TopOffset uint32
BottomOffset uint32
}
ConformanceWindow according to ISO/IEC 23008-2
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) 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
type NaluArray ¶
type NaluArray struct {
Nalus [][]byte
// contains filtered or unexported fields
}
NaluArray - HEVC NALU array including complete bit and type
func NewNaluArray ¶
NewNaluArray - create an HEVC NaluArray
type NaluType ¶
type NaluType uint16
NaluType - HEVC nal type according to ISO/IEC 23008-2 Table 7.1
func FindNaluTypes ¶
FindNaluTypes - find list of nalu types in sample
func FindNaluTypesUpToFirstVideoNalu ¶
FindNaluTypesUpToFirstVideoNalu - all nalu types up to first video nalu
func GetNaluType ¶
GetNaluType - extract NALU type from first byte of NALU Header
type ProfileTierLevel ¶
type ProfileTierLevel struct {
GeneralProfileSpace byte
GeneralTierFlag bool
GeneralProfileIDC byte
GeneralProfileCompatibilityFlags uint32
GeneralConstraintIndicatorFlags uint64 // 48 bits
GeneralProgressiveSourceFlag bool
GeneralInterlacedSourceFlag bool
GeneralNonPackedConstraintFlag bool
GeneralFrameOnlyConstraintFlag bool
// 43 + 1 bits of info
GeneralLevelIDC byte
}
ProfileTierLevel according to ISO/IEC 23008-2 Section 7.3.3
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
SpsTemporalMvpEnabledFlag bool
StrongIntraSmoothingEnabledFlag bool
VUIParametersPresentFlag bool
VUI *VUIParameters
}
SPS - HEVC SPS parameters ISO/IEC 23008-2 Sec. 7.3.2.2
func ParseSPSNALUnit ¶
ParseSPSNALUnit - Parse HEVC SPS NAL unit starting with NAL unit header
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 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
BitstreamRestrictionFlag bool
BitstreamResctrictions *BitstreamRestrictions
}
VUIParameters - Visual Usability Information as defined in Section E.2